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

Skip to content

Commit 18a6534

Browse files
committed
Updated project documentation
1 parent bad6881 commit 18a6534

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

docs/userguide/annotations.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,27 @@ A `%suitepath` can be provided in tree ways:
160160

161161
# Using automatic rollbacks in tests
162162

163-
By default, every test is isolated using savepoint.
163+
By default, changes performed by every setup, cleanup and test procedure is isolated using savepoint.
164164
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 (commit/rollback) or DDL commands.
165+
165166
In general, your unit tests should not use transaction control as long as the code you are testing is not using it too.
166167
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 development database.
167168

168169
If you are in situation, where the code you are testing, is using transaction control (common case with ETL code), then your tests probably should not use the default automatic transaction control.
169170
In that case use the annotation `-- %rollback(manual)` on the suite level to disable automatic transaction control for entire suite.
170-
If you are using nested suites, you need to make sure that thr entire suite all the way to the root is using manual transaction control.
171+
If you are using nested suites, you need to make sure that the entire suite all the way to the root is using manual transaction control.
172+
173+
It is possible with utPLSQL to change the transaction control on individual suites or tests that are part of complex suite.
174+
It is strongly recommended not to have mixed transaction control in suite.
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+
Your suite will most probably fail with error or warning on execution. Some of the automatic rollbacks will most probably fail to execute depending on the configuration you have.
171177

172178
In some cases it is needed to perform DDL as part of setup or cleanup for the tests.
173-
It is recommended to move such DDL statements to a procedure with `pragma autonomous_transaction` to eliminate implicit commit of the main session.
179+
It is recommended to move such DDL statements to a procedure with `pragma autonomous_transaction` to eliminate implicit commit in the main session that is executing all your tests.
174180
Doing so, allows your test to use automatic transaction control of the framework and release you from the burden of manual cleanup of data that was created or modified by test execution.
175181

182+
When you are running test of code that is performing an explicit or implicit commit, you may set the test procedure to run in 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.
176184

177185
# Order of execution
178186

docs/userguide/getting-started.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ end;
3131
/
3232
```
3333

34-
Execute all tests: `select * from table(ut.run());`
34+
Execute all tests: `begin ut.run(); end;`
3535

3636
Test results:
3737
```
@@ -55,7 +55,7 @@ end;
5555
/
5656
```
5757

58-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
58+
Execute test package: `begin ut.run('test_betwnstr'); end;`
5959

6060
Test results:
6161
```
@@ -88,7 +88,7 @@ end;
8888
/
8989
```
9090

91-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
91+
Execute test package: `begin ut.run('test_betwnstr'); end;`
9292

9393
Test results:
9494
```
@@ -121,7 +121,7 @@ end;
121121
/
122122
```
123123

124-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
124+
Execute test package: `begin ut.run('test_betwnstr'); end;`
125125

126126
Test results:
127127
```
@@ -154,7 +154,7 @@ end;
154154
/
155155
```
156156

157-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
157+
Execute test package: `begin ut.run('test_betwnstr'); end;`
158158

159159
Test results:
160160
```
@@ -228,7 +228,7 @@ end;
228228
/
229229
```
230230

231-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
231+
Execute test package: `begin ut.run('test_betwnstr'); end;`
232232

233233
Test results:
234234
```
@@ -265,7 +265,7 @@ end;
265265
/
266266
```
267267

268-
Execute test package: `select * from table(ut.run('test_betwnstr'));`
268+
Execute test package: `begin ut.run('test_betwnstr'); end;`
269269

270270
Test results:
271271
```

0 commit comments

Comments
 (0)