Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49ea193

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/version3' into feature/run_as_other_user
2 parents f313d58 + a3f604e commit 49ea193

96 files changed

Lines changed: 2510 additions & 1846 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis/create_utplsql_owner.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define ut3_tablespace = &3
1111

1212
create user &ut3_user identified by &ut3_password default tablespace &ut3_tablespace quota unlimited on &ut3_tablespace;
1313

14-
grant create session, create procedure, create type, create table to &ut3_user;
14+
grant create session, create procedure, create type, create table, create synonym to &ut3_user;
1515

1616
grant execute on dbms_pipe to &ut3_user;
1717
grant create job to &ut3_user;

client_source/grant_user.sql

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,23 @@ set verify off
1111
define ut3_owner = &1
1212
define ut3_user = &2
1313

14-
grant execute on &ut3_owner .be_between to &ut3_user;
15-
grant execute on &ut3_owner .be_false to &ut3_user;
16-
grant execute on &ut3_owner .be_greater_or_equal to &ut3_user;
17-
grant execute on &ut3_owner .be_greater_than to &ut3_user;
18-
grant execute on &ut3_owner .be_less_or_equal to &ut3_user;
19-
grant execute on &ut3_owner .be_less_than to &ut3_user;
20-
grant execute on &ut3_owner .be_like to &ut3_user;
21-
grant execute on &ut3_owner .be_not_null to &ut3_user;
22-
grant execute on &ut3_owner .be_null to &ut3_user;
23-
grant execute on &ut3_owner .be_true to &ut3_user;
24-
grant execute on &ut3_owner .equal to &ut3_user;
25-
grant execute on &ut3_owner .match to &ut3_user;
14+
grant execute on &ut3_owner .ut_be_between to &ut3_user;
15+
grant execute on &ut3_owner .ut_be_false to &ut3_user;
16+
grant execute on &ut3_owner .ut_be_greater_or_equal to &ut3_user;
17+
grant execute on &ut3_owner .ut_be_greater_than to &ut3_user;
18+
grant execute on &ut3_owner .ut_be_less_or_equal to &ut3_user;
19+
grant execute on &ut3_owner .ut_be_less_than to &ut3_user;
20+
grant execute on &ut3_owner .ut_be_like to &ut3_user;
21+
grant execute on &ut3_owner .ut_be_not_null to &ut3_user;
22+
grant execute on &ut3_owner .ut_be_null to &ut3_user;
23+
grant execute on &ut3_owner .ut_be_true to &ut3_user;
24+
grant execute on &ut3_owner .ut_equal to &ut3_user;
25+
grant execute on &ut3_owner .ut_match to &ut3_user;
2626
grant execute on &ut3_owner .ut to &ut3_user;
2727
grant execute on &ut3_owner .ut_runner to &ut3_user;
2828
grant execute on &ut3_owner .ut_teamcity_reporter to &ut3_user;
2929
grant execute on &ut3_owner .ut_documentation_reporter to &ut3_user;
3030
grant execute on &ut3_owner .ut_reporters to &ut3_user;
31-
grant execute on &ut3_owner .ut_assert_processor to &ut3_user;
3231

3332
create or replace synonym &ut3_user .be_between for &ut3_owner .be_between;
3433
create or replace synonym &ut3_user .be_false for &ut3_owner .be_false;
@@ -47,5 +46,3 @@ create or replace synonym &ut3_user .ut_runner for &ut3_owner .ut_runner;
4746
create or replace synonym &ut3_user .ut_teamcity_reporter for &ut3_owner .ut_teamcity_reporter;
4847
create or replace synonym &ut3_user .ut_documentation_reporter for &ut3_owner .ut_documentation_reporter;
4948
create or replace synonym &ut3_user .ut_reporters for &ut3_owner .ut_reporters;
50-
create or replace synonym &ut3_user .ut_assert_processor for &ut3_owner .ut_assert_processor;
51-

client_source/sqlplus/ut_run.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Parameters:
1414
-p=ut_path(s)- A path or a comma separated list of paths to unit test to be executed.
1515
The path can be in one of the following formats:
1616
schema[.package[.procedure]]
17-
schema:suitepacakge[.suitepackage[.suitepackage][...]][.procedure]
17+
schema:suite[.suite[.suite][...]][.procedure]
1818
Both formats can be mixed in the comma separated list.
1919
If only schema is provided, then all suites owner by that schema (user) are executed.
2020
If -p is omitted, the current schema is used.

docs/userguide/annotations.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
# Annotations
22

33
Annotations provide a way to configure tests and suites in a declarative way similar to modern OOP languages.
4+
The annotation list is based on jUnit 5 implementation.
45

56
# Example
67
Let's say we have the test package like this:
78
```
89
create or replace package test_pkg is
910
10-
-- %suite(Name of suite)
11-
-- %suitepackage(all.globaltests)
12-
-- %suitetype(critical)
11+
-- %suite
12+
-- %displayname(Name of suite)
13+
-- %suitepath(all.globaltests)
1314
14-
-- %suitesetup
15+
-- %beforeall
1516
procedure globalsetup;
1617
17-
-- %suiteteardown
18+
-- %afterall
1819
procedure global_teardown;
1920
2021
/* Such comments are allowed */
2122
22-
-- %test(Name of test1)
23-
-- %testtype(smoke)
23+
-- %test
24+
-- %displayname(Name of test1)
2425
procedure test1;
2526
26-
-- %test(Name of test2)
27-
-- %testsetup(setup_test1)
28-
-- %testteardown(teardown_test1)
27+
-- %test
28+
-- %displayname(Name of test2)
29+
-- %beforetest(setup_test1)
30+
-- %aftertest(teardown_test1)
2931
procedure test2;
3032
31-
-- %test(Name of test3)
33+
-- %test
34+
-- %displayname(Name of test3)
3235
-- %testtype(smoke)
3336
procedure test3;
3437
3538
procedure setup_test1;
3639
3740
procedure teardown_test1;
3841
39-
-- %setup
42+
-- %beforeeach
4043
procedure setup;
4144
42-
-- %teardown
45+
-- %aftereach
4346
procedure teardown;
4447
4548
end test_pkg;
4649
```
4750

4851
#Annotations meaning
4952

50-
Annotation | Meaning
51-
------------ | -------------
52-
%suite | Marks package to be a suite with it procedures as tests. This way all testing packages might be found in the schema. Parameter of the annotation is the Suite name
53-
%suitepackage | Similar to java package. The example suite should be put as an element of the "globaltests" suite which is an element of the "all" suite. This allows one to execute "glovaltests" suite which would recursively run all the child suites including this one.
54-
%suitetype | The way for suite to have something like a type. One might collect suites based on the subject of tests (a system module for example). There might be critical tests to run every time and more covering but slow tests. This technique allows to configure something like "fast" testing.
55-
%setup | Marks procedure as a default setup procedure for the suite.
56-
%teardown | Marks procedure as a default teardown procedure for the suite.
57-
%test | Marks procedure as a test. Parameter is a name of the test
58-
%testtype | Another way to tag tests to filter afterwards
59-
%testsetup | Marks that special setup procedure has to be run before the test instead of the default one
60-
%testteardown | Marks that special teardown procedure has to be run before the test instead of the default one
61-
%suitesetup | Procedure with executes once at the beginning of the suite and doesn't executes before each test
62-
%suiteteardown | Procedure with executes once after the execution of the last test in the suite.
53+
| Annotation |Level| Describtion |
54+
| --- | --- | --- |
55+
| `%suite` | Package | Marks package to be a suite of tests This way all testing packages might be found in a schema. |
56+
| `%suitepath(<path>)` | Package | Similar to java package. The annotation allows logical grouping of suites into hierarcies. |
57+
| `%displayname(<description>)` | Package/procedure | Human-familiar describtion of the suite/test. `%displayname(Name of the suite/test)` |
58+
| `%test` | Procedure | Denotes that a method is a test method. |
59+
| `%beforeall` | Procedure | Denotes that the annotated procedure should be executed once before all elements of the current suite. |
60+
| `%afterall` | Procedure | Denotes that the annotated procedure should be executed once after all elements of the current suite. |
61+
| `%beforeeach` | Procedure | Denotes that the annotated procedure should be executed before each `%test` method in the current suite. |
62+
| `%aftereach` | Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
63+
| `%beforetest(<procedure_name>)` | Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
64+
| `%aftertest(<procedure_name>)` | Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
65+
| `%rollback(<type>)` | Package/procedure | Configure transaction control behaviour (type). Supported values: `auto`(default) - rollback to savepoint (before the test/suite setup) is issued after each test/suite teardown; `manual` - rollback is never issued automatically. Property can be overridden for child element (test in suite) |
66+
| `%disable` | Package/procedure | Used to disable a suite or a test |
6367

6468
Annotations allow us to configure test infrastructure in a declarative way without anything stored in tables or config files. Suite manager would scan the schema for all the suitable packages, automatically configure suites and execute them. This can be simplified to the situation when you just ran suite manager over a schema for the defined types of tests and reporters and everything goes automatically. This is going to be convenient to be executed from CI tools using standard reporting formats.
65-

examples/RunWithDocumentationReporter.sql

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ set linesize 10000
33
set echo off
44

55
create or replace package demo_doc_reporter1 is
6-
-- %suite(Demo of documentation reporter)
7-
-- %test(A passing test sample)
6+
-- %suite
7+
-- %displayname(Demo of documentation reporter)
8+
9+
-- %test
10+
-- %displayname(A passing test sample)
811
procedure passing_test;
912
-- %test
1013
procedure test_without_name;
11-
-- %test(A failing test exsample)
14+
-- %test
15+
-- %displayname(A failing test exsample)
1216
procedure failing_test;
1317
-- %test
1418
procedure failing_no_name;
15-
-- %test(repoting exception)
19+
-- %test
20+
-- %displayname(repoting exception)
1621
procedure failing_exception_raised;
1722
end;
1823
/
@@ -43,8 +48,11 @@ end;
4348
/
4449

4550
create or replace package demo_doc_reporter2 is
46-
-- %suite(A suite package without body)
47-
-- %test(A test)
51+
-- %suite
52+
-- %displayname(A suite package without body)
53+
54+
-- %test
55+
-- %displayname(A test)
4856
procedure test1;
4957
-- %test
5058
procedure test2;
@@ -53,9 +61,12 @@ end;
5361

5462
create or replace package suite_package_without_name is
5563
-- %suite
56-
-- %test(A passing test sample)
64+
65+
-- %test
66+
-- %displayname(A passing test sample)
5767
procedure passing_test1;
58-
-- %test(A passing test sample)
68+
-- %test
69+
-- %displayname(A passing test sample)
5970
procedure passing_test2;
6071
end;
6172
/

examples/award_bonus/test_award_bonus.pkg

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
create or replace package test_award_bonus as
22

3-
-- %suite(Award bonus)
3+
-- %suite
4+
-- %displayname(Award bonus)
45

5-
-- %test(Sets new salary as pct commision * sales amount)
6-
-- %testsetup(add_test_employee)
6+
-- %test
7+
-- %displayname(Sets new salary as pct commision * sales amount)
8+
-- %beforetest(add_test_employee)
79
procedure update_employee_salary;
810

9-
-- %test(Raises exception if null bonus is passed)
10-
-- %testsetup(add_employee_with_null_comm)
11+
-- %test
12+
-- %displayname(Raises exception if null bonus is passed)
13+
-- %beforetest(add_employee_with_null_comm)
1114
procedure fail_on_null_bonus;
1215

1316
procedure add_test_employee;
@@ -16,7 +19,6 @@ create or replace package test_award_bonus as
1619

1720
end;
1821
/
19-
2022
create or replace package body test_award_bonus as
2123

2224
gc_test_employee constant integer := -1;

examples/between_string/test_betwnstr.pkg

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
create or replace package test_betwnstr as
22

3-
-- %suite(Between string function)
3+
-- %suite
4+
-- %displayname(Between string function)
45

5-
-- %test(Returns substring from start position to end position)
6+
-- %test
7+
-- %displayname(Returns substring from start position to end position)
68
procedure normal_case;
79

8-
-- %test(Returns substring when start position is zero)
10+
-- %test
11+
-- %displayname(Returns substring when start position is zero)
912
procedure zero_start_position;
1013

11-
-- %test(Returns string until end if end position is greated than string length)
14+
-- %test
15+
-- %displayname(Returns string until end if end position is greated than string length)
1216
procedure big_end_position;
1317

14-
-- %test(Returns null for null inlut srting value)
18+
-- %test
19+
-- %displayname(Returns null for null inlut srting value)
1520
procedure null_string;
1621
end;
1722
/
18-
1923
create or replace package body test_betwnstr as
2024

2125
procedure normal_case is

examples/demo_expectations.pck

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,70 @@
11
create or replace package demo_expectations is
22

3-
-- %suite(Demoing asserts)
3+
-- %suite
4+
-- %displayname(Demoing asserts)
45

5-
-- %test(demo of expectations with nulls)
6+
-- %test
7+
-- %displayname(demo of expectations with nulls)
68
procedure demo_nulls_on_expectations;
79

8-
-- %test(demo of failure for to_equal expectation on value mismatch)
10+
-- %test
11+
-- %displayname(demo of failure for to_equal expectation on value mismatch)
912
procedure demo_to_equal_failure;
1013

11-
-- %test(demo of failure for to_equal expectation on data type mismatch)
14+
-- %test
15+
-- %displayname(demo of failure for to_equal expectation on data type mismatch)
1216
procedure demo_to_equal_failure_types;
1317

14-
-- %test(demo of success for to_equal expectation)
18+
-- %test
19+
-- %displayname(demo of success for to_equal expectation)
1520
procedure demo_to_equal_success;
1621

17-
-- %test(demo of failure for to_be_true and to_be_false expectation)
22+
-- %test
23+
-- %displayname(demo of failure for to_be_true and to_be_false expectation)
1824
procedure demo_to_be_true_false_failure;
1925

20-
-- %test(demo of success for to_be_true and to_be_false expectation)
26+
-- %test
27+
-- %displayname(demo of success for to_be_true and to_be_false expectation)
2128
procedure demo_to_be_true_false_success;
2229

23-
-- %test(demo of failure for to_be_null expectation )
30+
-- %test
31+
-- %displayname(demo of failure for to_be_null expectation )
2432
procedure demo_to_be_null_failure;
2533

26-
-- %test(demo of failure for to_be_null expectation )
34+
-- %test
35+
-- %displayname(demo of failure for to_be_null expectation )
2736
procedure demo_to_be_null_success;
2837

29-
-- %test(demo of success for to_be_not_null expectation )
38+
-- %test
39+
-- %displayname(demo of success for to_be_not_null expectation )
3040
procedure demo_to_be_not_null_failure;
3141

32-
-- %test(demo of success for to_be_not_null expectation)
42+
-- %test
43+
-- %displayname(demo of success for to_be_not_null expectation)
3344
procedure demo_to_be_not_null_success;
3445

35-
-- %test(demo of failure for to_match expectation)
46+
-- %test
47+
-- %displayname(demo of failure for to_match expectation)
3648
procedure demo_to_match_failure;
3749

38-
-- %test(demo of success for to_match expectation)
50+
-- %test
51+
-- %displayname(demo of success for to_match expectation)
3952
procedure demo_to_match_success;
4053

41-
-- %test(demo of failure for to_be_like expectation)
54+
-- %test
55+
-- %displayname(demo of failure for to_be_like expectation)
4256
procedure demo_to_be_like_failure;
4357

44-
-- %test(demo of success for to_be_like expectation)
58+
-- %test
59+
-- %displayname(demo of success for to_be_like expectation)
4560
procedure demo_to_be_like_success;
4661

47-
-- %test(demo of failure for not_to expectations)
62+
-- %test
63+
-- %displayname(demo of failure for not_to expectations)
4864
procedure demo_not_to_failure;
4965

50-
-- %test(demo of success for not_to expectations)
66+
-- %test
67+
-- %displayname(demo of success for not_to expectations)
5168
procedure demo_not_to_success;
5269

5370
end;

0 commit comments

Comments
 (0)