You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/userguide/annotations.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
# Annotations
2
2
3
3
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.
4
+
The annotation list is based on moder testing framework such as jUnit 5, RSpec.
5
5
6
-
# Example
7
-
Let's say we have the test package like this:
6
+
Annotations allow to configure test infrastructure in a declarative way without anything stored in tables or config files. The framework runner scans the schema for all the suitable annotated packages, automatically configures suites, forms hierarchy from then and executes them.
7
+
8
+
# Example of annotated package
8
9
```
9
10
create or replace package test_pkg is
10
11
11
-
-- %suite
12
-
-- %displayname(Name of suite)
12
+
-- %suite(Name of suite)
13
13
-- %suitepath(all.globaltests)
14
14
15
15
-- %beforeall
@@ -24,16 +24,19 @@ create or replace package test_pkg is
24
24
-- %displayname(Name of test1)
25
25
procedure test1;
26
26
27
-
-- %test
28
-
-- %displayname(Name of test2)
27
+
-- %test(Name of test2)
29
28
-- %beforetest(setup_test1)
30
29
-- %aftertest(teardown_test1)
31
30
procedure test2;
32
31
33
32
-- %test
34
33
-- %displayname(Name of test3)
35
-
-- %testtype(smoke)
34
+
-- %disable
36
35
procedure test3;
36
+
37
+
-- %test(Name of test4)
38
+
-- %rollback(manual)
39
+
procedure test4;
37
40
38
41
procedure setup_test1;
39
42
@@ -52,17 +55,15 @@ end test_pkg;
52
55
53
56
| Annotation |Level| Describtion |
54
57
| --- | --- | --- |
55
-
|`%suite`| Package | Marks package to be a suite of tests This way all testing packages might be found in a schema. |
58
+
|`%suite(<description>)`| Package | Marks package to be a suite of tests This way all testing packages might be found in a schema. Optional schema discription can by provided, similar to `%displayname` annotation. |
56
59
|`%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. |
60
+
|`%displayname(<description>)`| Package/procedure | Human-familiar describtion of the suite/test. Syntax is based on jUnit annotation: `%displayname(Name of the suite/test)`|
61
+
|`%test(<description>)`| Procedure | Denotes that a method is a test method. Optional test discription can by provided, similar to `%displayname` annotation. |
59
62
|`%beforeall`| Procedure | Denotes that the annotated procedure should be executed once before all elements of the current suite. |
60
63
|`%afterall`| Procedure | Denotes that the annotated procedure should be executed once after all elements of the current suite. |
61
64
|`%beforeeach`| Procedure | Denotes that the annotated procedure should be executed before each `%test` method in the current suite. |
62
65
|`%aftereach`| Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
63
66
|`%beforetest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
64
67
|`%aftertest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
65
68
|`%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 |
67
-
68
-
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.
69
+
|`%disable`| Package/procedure | Used to disable a suite or a test |
Copy file name to clipboardExpand all lines: readme.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,76 @@ The following table is a work in progress right now, and **will** change. If y
67
67
68
68
<sup>3</sup> Test execution comparison is in a single call so the results are combined. We know it was always possible group in any way with multiple calls. But that may not be desired under CI system where you want a single JUnit XML Output.
69
69
70
+
# Annotations
71
+
72
+
Annotations provide a way to configure tests and suites in a declarative way similar to modern OOP languages.
73
+
The annotation list is based on moder testing framework such as jUnit 5, RSpec.
74
+
75
+
Annotations allow to configure test infrastructure in a declarative way without anything stored in tables or config files. The framework runner scans the schema for all the suitable annotated packages, automatically configures suites, forms hierarchy from then and executes them.
76
+
77
+
# Example of annotated package
78
+
```
79
+
create or replace package test_pkg is
80
+
81
+
-- %suite(Name of suite)
82
+
-- %suitepath(all.globaltests)
83
+
84
+
-- %beforeall
85
+
procedure globalsetup;
86
+
87
+
-- %afterall
88
+
procedure global_teardown;
89
+
90
+
/* Such comments are allowed */
91
+
92
+
-- %test
93
+
-- %displayname(Name of test1)
94
+
procedure test1;
95
+
96
+
-- %test(Name of test2)
97
+
-- %beforetest(setup_test1)
98
+
-- %aftertest(teardown_test1)
99
+
procedure test2;
100
+
101
+
-- %test
102
+
-- %displayname(Name of test3)
103
+
-- %disable
104
+
procedure test3;
105
+
106
+
-- %test(Name of test4)
107
+
-- %rollback(manual)
108
+
procedure test4;
109
+
110
+
procedure setup_test1;
111
+
112
+
procedure teardown_test1;
113
+
114
+
-- %beforeeach
115
+
procedure setup;
116
+
117
+
-- %aftereach
118
+
procedure teardown;
119
+
120
+
end test_pkg;
121
+
```
122
+
123
+
#Annotations meaning
124
+
125
+
| Annotation |Level| Describtion |
126
+
| --- | --- | --- |
127
+
|`%suite(<description>)`| Package | Marks package to be a suite of tests This way all testing packages might be found in a schema. Optional schema discription can by provided, similar to `%displayname` annotation. |
128
+
|`%suitepath(<path>)`| Package | Similar to java package. The annotation allows logical grouping of suites into hierarcies. |
129
+
|`%displayname(<description>)`| Package/procedure | Human-familiar describtion of the suite/test. Syntax is based on jUnit annotation: `%displayname(Name of the suite/test)`|
130
+
|`%test(<description>)`| Procedure | Denotes that a method is a test method. Optional test discription can by provided, similar to `%displayname` annotation. |
131
+
|`%beforeall`| Procedure | Denotes that the annotated procedure should be executed once before all elements of the current suite. |
132
+
|`%afterall`| Procedure | Denotes that the annotated procedure should be executed once after all elements of the current suite. |
133
+
|`%beforeeach`| Procedure | Denotes that the annotated procedure should be executed before each `%test` method in the current suite. |
134
+
|`%aftereach`| Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
135
+
|`%beforetest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
136
+
|`%aftertest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
137
+
|`%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) |
138
+
|`%disable`| Package/procedure | Used to disable a suite or a test |
Copy file name to clipboardExpand all lines: tests/ut_suite_manager/ut_suite_manager.configure_execution_by_path.PrepareRunnerForTheTopPackageByName.sql
Copy file name to clipboardExpand all lines: tests/ut_suite_manager/ut_suite_manager.configure_execution_by_path.PrepareRunnerForTheTopPackageProcedureByPath.sql
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ begin
26
26
l_test_proc := treat(l_test1_suite.items(1) as ut_test);
27
27
28
28
ut.expect(l_test_proc.name).to_equal('test2');
29
+
ut.expect(l_test_proc.description).to_equal('Test2 from test package 1');
29
30
ut.expect(l_test_proc.before_testis not null).to_be_true;
30
31
ut.expect(l_test_proc.after_testis not null).to_be_true;
0 commit comments