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

Skip to content

Commit 1be8914

Browse files
committed
Added tests for behavior when execution invalid objects or unit test code that is raising exceptions in different blocks.
Changed error message raised when suite is not found to be more adequate to the reasons for the error.
1 parent 4d2789c commit 1be8914

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

docs/userguide/annotations.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,19 @@ end test_pkg;
7272
| `%aftereach` | Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
7373
| `%beforetest(<procedure_name>)` | Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
7474
| `%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) |
7676
| `%disabled` | Package/procedure | Used to disable a suite or a test |
7777

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+
7888
# Suitepath concept
7989
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.
8090

@@ -148,3 +158,4 @@ A `%suitepath` can be provided in tree ways:
148158
* schema - execute all test in the schema
149159
* [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`.
150160
* [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.
161+

0 commit comments

Comments
 (0)