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
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
1
# Annotations
2
2
3
3
Annotations are used to configure tests and suites in a declarative way similar to modern OOP languages. This way, test configuration is stored along with the test logic inside the test package.
4
-
No configuration files or tables are needed. The annotations names are based on popular testing frameworks such as jUnit.
5
-
The framework runner searches for all the suitable annotated packages, automatically configures suites, forms suites hierarchy, executes it and reports results in specified formats.
4
+
No configuration files or tables are needed. The annotation names are based on popular testing frameworks such as jUnit.
5
+
The framework runner searches for all the suitable annotated packages, automatically configures suites, forms the suite hierarchy, executes it and reports results in specified formats.
6
6
7
-
Annotations are interpreted only in package specification and are case-insensitive. It is recommended however, to use the lower-case annotations as described in documentation.
7
+
Annotations are interpreted only in the package specification and are case-insensitive. It is recommended however, to use lower-case annotations as described in this documentation.
8
8
9
-
There are two places where annotations may appear:
9
+
There are two places where annotations may appear:
10
10
11
-
- at the beginning of the package specification (`%suite`, `%suitepath` etc)
12
-
- right before a procedure (`%test`, `%beforeall`, `%beforeeach` etc).
11
+
- at the beginning of the package specification (`%suite`, `%suitepath` etc.)
12
+
- right before a procedure (`%test`, `%beforeall`, `%beforeeach` etc.)
13
13
14
-
Package level annotations need to be separated by at least one empty line from the underlying procedure annotations.
14
+
Package level annotations need to be separated by at least one empty line from the underlying procedure annotations.
15
15
16
16
Procedure annotations are defined right before the procedure they reference, no empty lines are allowed.
17
17
18
-
If a package specification contains `%suite` annotation, it is treated as a test package and processed by the framework.
18
+
If a package specification contains the `%suite` annotation, it is treated as a test package and is processed by the framework.
19
19
20
20
Some annotations accept parameters like `%suite`, `%test` and `%displayname`. The parameters for annotations need to be placed in brackets. Values for parameters should be provided without any quotation marks.
21
21
@@ -48,7 +48,7 @@ create or replace package test_pkg is
48
48
-- %displayname(Name of test)
49
49
-- %disabled
50
50
procedure disabled_test;
51
-
51
+
52
52
-- %test(Name of test)
53
53
-- %rollback(manual)
54
54
procedure no_transaction_control_test;
@@ -72,15 +72,15 @@ end test_pkg;
72
72
| --- | --- | --- |
73
73
|`%suite(<description>)`| Package | Mandatory. Marks package as a test suite. Optional suite description can be provided (see `displayname`). |
74
74
|`%suitepath(<path>)`| Package | Similar to java package. The annotation allows logical grouping of suites into hierarchies. |
75
-
|`%displayname(<description>)`| Package/procedure | Human-readable and meaningful description of a suite/test. `%displayname(Name of the suite/test)`. The annotation is provided for flexibility and convenience only. It has exactly the same meaning as `<descriotion>` in `test` and `suite` annotations. If description is provided using both `suite`/`test` and `displayname`, then the one defined as last takes precedence. |
75
+
|`%displayname(<description>)`| Package/procedure | Human-readable and meaningful description of a suite/test. `%displayname(Name of the suite/test)`. The annotation is provided for flexibility and convenience only. It has exactly the same meaning as `<description>` in `test` and `suite` annotations. If description is provided using both `suite`/`test` and `displayname`, then the one defined as last takes precedence. |
76
76
|`%test(<description>)`| Procedure | Denotes that the annotated procedure is a unit test procedure. Optional test description can by provided (see `displayname`). |
77
77
|`%beforeall`| Procedure | Denotes that the annotated procedure should be executed once before all elements of the suite. |
78
78
|`%afterall`| Procedure | Denotes that the annotated procedure should be executed once after all elements of the suite. |
79
79
|`%beforeeach`| Procedure | Denotes that the annotated procedure should be executed before each `%test` procedure in the suite. |
80
80
|`%aftereach`| Procedure | Denotes that the annotated procedure should be executed after each `%test` procedure in the suite. |
81
81
|`%beforetest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
82
82
|`%aftertest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
83
-
|`%rollback(<type>)`| Package/procedure | Defines transaction control. Supported values: `auto`(default) - A savepoint is created before invocation of each "before block" is and a rollback to specific savepoint is issued after each "after" block; `manual` - rollback is never issued automatically. Property can be overridden for child element (test in suite) |
83
+
|`%rollback(<type>)`| Package/procedure | Defines transaction control. Supported values: `auto`(default) - a savepoint is created before invocation of each "before block" is and a rollback to specific savepoint is issued after each "after" block; `manual` - rollback is never issued automatically. Property can be overridden for child element (test in suite) |
84
84
|`%disabled`| Package/procedure | Used to disable a suite or a test. Disabled suites/tests do not get executed, they are however marked and reported as disabled in a test run. |
85
85
86
86
# Suitepath concept
@@ -94,10 +94,10 @@ If you want to create tests for your application it is recommended to structure
94
94
* Policy tests
95
95
* Claim tests
96
96
* Payment tests
97
-
* Payments recognition
97
+
* Payments recognition
98
98
* Payments set off
99
-
* Payouts
100
-
99
+
* Payouts
100
+
101
101
The `%suitepath` annotation is used for such grouping. Even though test packages are defined in a flat structure the `%suitepath` is used by the framework to form them into a hierarchical structure. Your payments recognition test package might look like:
102
102
103
103
```sql
@@ -137,7 +137,7 @@ end test_payment_set_off;
137
137
```
138
138
139
139
When you execute tests for your application, the framework constructs a test suite for each test package. Then it combines suites into grouping suites by the `%suitepath` annotation value so that the fully qualified path to the `recognize_by_num` procedure is `USER:payments.test_payment_recognition.test_recognize_by_num`. If any of its expectations fails then the test is marked as failed, also the `test_payment_recognition` suite, the parent suite `payments` and the whole run is marked as failed.
140
-
The test report indicates which expectation has failed on the payments module. The payments recognition submodule is causing the failure as `recognize_by_num` has not met the expectations of the test. Grouping tests into modules and submodules using the `%suitepath` annotation allows you to logically organize your project's flat structure of packages into functional groups.
140
+
The test report indicates which expectation has failed on the payments module. The payments recognition submodule is causing the failure as `recognize_by_num` has not met the expectations of the test. Grouping tests into modules and submodules using the `%suitepath` annotation allows you to logically organize your project's flat structure of packages into functional groups.
141
141
142
142
An additional advantage of such grouping is the fact that every element level of the grouping can be an actual unit test package containing a common module level setup for all of the submodules. So in addition to the packages mentioned above you could have the following package.
143
143
```sql
@@ -175,12 +175,12 @@ It is strongly recommended not to have mixed transaction control in a suite.
175
175
Mixed transaction control settings will not work properly when your suites are using shared setup/cleanup with beforeall, afterall, beforeeach or aftereach annotations.
176
176
Your suite will most likely fail with error or warning on execution. Some of the automatic rollbacks will probably fail to execute depending on the configuration you have.
177
177
178
-
In some cases it is necessary to perform DDL as part of setup or cleanup for the tests.
178
+
In some cases it is necessary to perform DDL as part of setup or cleanup for the tests.
179
179
It is recommended to move such DDL statements to a procedure with `pragma autonomous_transaction` to eliminate implicit commits in the main session that is executing all your tests.
180
180
Doing so allows your tests to use the framework's automatic transaction control and releases you from the burden of manual cleanup of data that was created or modified by test execution.
181
181
182
182
When you are testing code that performs explicit or implicit commits, you may set the test procedure to run as an autonomous transaction with `pragma autonomous_transaction`.
183
-
Keep in mind that when your tests runs in autonomous transaction it will not see the data prepared in setup procedure unless the setup procedure committed the changes.
183
+
Keep in mind that when your tests runs in autonomous transaction it will not see the data prepared in setup procedure unless the setup procedure committed the changes.
184
184
185
185
# Order of execution
186
186
@@ -189,23 +189,23 @@ When processing the test suite `test_pkg` defined in [Example of annotated test
Copy file name to clipboardExpand all lines: docs/userguide/install.md
+21-13Lines changed: 21 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ This will create a new user `UT3` with password `XNtxj8eEgA6X6b6f`, grant all ne
59
59
Example invocation of the script from command line:
60
60
```bash
61
61
cdsource
62
-
sqlplus sys/sys_pass@db as sysdba @@install_headless.sql
62
+
sqlplus sys/sys_pass@db as sysdba @install_headless.sql
63
63
```
64
64
65
65
SYSDBA is needed to grant access to DBMS_LOCK.
@@ -90,7 +90,7 @@ It is up to DBA to maintain the storage of the profiler tables.
90
90
# Installation Procedure
91
91
92
92
### Creating schema for utPLSQL
93
-
To create the utPLSQL schema and grant all the needed privileges execute script `create_utplsql_owner.sql` from the `source` directory with parameters:
93
+
To create the utPLSQL schema and grant all the required privileges execute script `create_utplsql_owner.sql` from the `source` directory with parameters:
94
94
95
95
-`user name` - the name of the user that will own of utPLSQL object
96
96
-`password` - the password to be set for that user
To grant utPLSQL to individual user execute script `source/create_synonyms_and_grants_for_user.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for.
130
+
To grant utPLSQL to an individual user, execute script `source/create_synonyms_and_grants_for_user.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for.
131
131
132
132
Example invocation:
133
133
```bash
@@ -143,31 +143,39 @@ The following tools that support the SQL*Plus commands can be used to run the in
143
143
144
144
# Additional requirements
145
145
146
-
In order to use Code Coverage functionality of utPLSQL, users executing the tests must have the CREATE privilege on the PLSQL code that the coverage is gathered on.
146
+
In order to use the Code Coverage functionality of utPLSQL, users executing the tests must have the CREATE privilege on the PLSQL code that the coverage is gathered on.
147
147
This is a requirement of [DBMS_PROFILER package](https://docs.oracle.com/cd/E18283_01/appdev.112/e16760/d_profil.htm#i999476).
148
148
149
149
In practice, user running tests for PLSQL code that he does not own, needs to have CREATE ANY PROCEDURE/CREATE ANY TRIGGER privileges.
150
150
Running code coverage on objects that the user does not own will **not produce any coverage information** without those privileges.
151
151
152
152
# Uninstalling utPLSQL
153
153
154
-
To uninstall run `/source/uninstall.sql` and provide `schema_name` where utPLSQL is installed.
154
+
To uninstall run `uninstall.sql` and provide `schema_name` where utPLSQL is installed.
The uninstall script will remove all the objects installed by the install script.
157
-
Additionally, all the public and private synonyms pointing to the objects in utPLSQL schema will be removed.
163
+
Additionally, all the public and private synonyms pointing to the objects in the utPLSQL schema will be removed.
164
+
165
+
If you have extended any utPLSQL types such as a custom reporter, these will need to be dropped before the uninstall, otherwise the uninstall script might fail.
158
166
159
-
If you have you have extended any utPLSQL types such as a custom reporter, these will need to be dropped before the uninstall, otherwise the uninstall script might fail.
167
+
The uninstall script does not drop the schema.
160
168
161
-
In order for the uninstall to be successful, you need to use the uninstall script, that was provided whit the exact version that was installed on your database.
162
-
The uninstall script provided with version 3.0.1 will probably not work, if you want to remove version 3.0.0 from your database.
169
+
In order for the uninstall to be successful, you need to use the uninstall script that was provided with the exact utPLSQL version installed on your database.
170
+
i.e. the uninstall script provided with version 3.0.1 will probably not work if you want to remove version 3.0.0 from your database.
163
171
164
172
# Version upgrade
165
173
166
-
Currently, the only way to upgrade version of utPLSQL v3.0.0 and above is to remove the previous version and install new version
174
+
Currently, the only way to upgrade version of utPLSQL v3.0.0 and above is to remove the previous version and install the new version.
167
175
168
176
# Working with utPLSQL v2
169
177
170
178
If you are using utPLSQL v2, you can still install utPLSQL v3.
171
-
The only requirement is that utPLSQL v3 needs to be installed in different schema than utPLSQL v2.
179
+
The only requirement is that utPLSQL v3 needs to be installed in a different schema than utPLSQL v2.
172
180
173
181
utPLSQL v3 and utPLSQL v2 do not collide on public synonym names.
0 commit comments