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
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,9 +72,19 @@ end test_pkg;
72
72
|`%aftereach`| Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
73
73
|`%beforetest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
74
74
|`%aftertest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
75
-
|`%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) |
75
+
|`%rollback(<type>)`| Package/procedure | Configure transaction control behaviour (type). Supported values: `auto`(default) - A savepoint is created before 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) |
76
76
|`%disabled`| Package/procedure | Used to disable a suite or a test |
77
77
78
+
# Using automatic rollbacks in tests
79
+
By default, every test is isolated from other tests using savepoint.
80
+
This solution is suitable for use-cases, where the code that is getting tested as well as the unit tests themselves do not use transaction control commands (commit/rollback).
81
+
In general, your unit tests should not use transaction control as long as the core you are testing is not using it too.
82
+
Keeping the transactions uncommitted allows your changes to be isolated and the execution of tests is not impacting others that might be using a shared (integration) development database.
83
+
84
+
If however you're in situation, where the code you are testing, is using transaction control (like ETL code is usually doing), then your tests should not use the default rollback(auto)
85
+
You should make sure that thr entire suitepath all the way to the root is using manual transaction control in that case.
86
+
87
+
78
88
# Suitepath concept
79
89
It is very likely that the application for which you are going to introduce tests consists of many different packages or procedures/functions. Usually procedures can be logically grouped inside a package, there also might be several logical groups of procedure in a single package or even packages themselves might relate to a common module.
80
90
@@ -148,3 +158,4 @@ A `%suitepath` can be provided in tree ways:
148
158
* schema - execute all test in the schema
149
159
*[schema]:suite1[.suite2][.suite3]...[.procedure] - execute all tests in all suites from suite1[.suite2][.suite3]...[.procedure] path. If schema is not provided, then current schema is used. Example: `:all.rooms_tests`.
150
160
*[schema.]package[.procedure] - execute all tests in the test package provided. The whole hierarchy of suites in the schema is build before, all before/after hooks of partn suites for th provided suite package are executed as well. Example: `tests.test_contact.test_last_name_validator` or simply `test_contact.test_last_name_validator` if `tests` is the current schema.
0 commit comments