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

Skip to content

Commit ee89c42

Browse files
committed
Updated exception-reporting.
1 parent 96d3d25 commit ee89c42

1 file changed

Lines changed: 70 additions & 70 deletions

File tree

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,42 @@
11
# Exception handling and reporting
22

3-
The utPLSQL is responsibly for handling exceptions wherever they occure in the test run. Exceptions are pororted as follows:
3+
The utPLSQL is responsible for handling exceptions wherever they occur in the test run. utPLSQL is trapping most of the exceptions so that the test execution is not affected by individual tests or test packages throwing an exception.
4+
The framework provides a full stacktrace for every exception that was thrown. The stacktrace is clean and does not include any utPLSQL library calls in it.
5+
To achieve rerunability, the ORA-04068, ORA-04061 exceptions are not handled and test execution will be interrupted if such exception is encountered. This is because of how Oracle behaves on those exceptions.
46

5-
* A test package without body faced - each `%test` is reported as failed
6-
* A test package with _invalid body_ - each `%test` is reported as failed
7-
* A test package with _invalid spec_ - *`%test`s are skipped*. Only valid specifications are parsed for annotations.
8-
* A test package that is raising an exception in beforeall - each `%test` is reported as failed
9-
* A test package that is raising an exception in afterall - `%test` are reported normally, warnings are displayed in the summary
7+
Test execution can fail for different reasons. The failures on different exceptions are handled as follows:
8+
* A test package without body - each `%test` is reported as failed with exception, nothing is executed
9+
* A test package with _invalid body_ - each `%test` is reported as failed with exception, nothing is executed
10+
* A test package with _invalid spec_ - package is not considered a valid unit test package and is excluded from execution. When trying to run a test package with invalid spec explicitly, exception is raised. Only valid specifications are parsed for annotations
11+
* A test package that is raising an exception in `%beforeall` - each `%test` is reported as failed with exception, `%test`, `%beforeeach`, `%beforetest`, `%aftertest` and `%aftereach` are not executed. `%afterall` is executed to allow cleanup of whatever was done in `%beforeall`
12+
* A test package that is raising an exception in `%beforeeach` - each `%test` is reported as failed with exception, `%test`, `%beforetest` and `%aftertest` is not executed. The `%aftereach` and `%afterall` blocks are getting executed to allow cleanup of whatever was done in `%before...` blocks
13+
* A test package that is raising an exception in `%beforetest` - the `%test` is reported as failed with exception, `%test` is not executed. The `%aftertest`, `%aftereach` and `%afterall` blocks are getting executed to allow cleanup of whatever was done in `%before...` blocks
14+
* A test package that is raising an exception in `%test` - the `%test` is reported as failed with exception. The execution of other blocks continues normally
15+
* A test package that is raising an exception in `%aftertest` - the `%test` is reported as failed with exception. The execution of other blocks continues normally
16+
* A test package that is raising an exception in `%aftereach` - all blocks of the package are executed, as ehe `%aftereach` is a closing block for an individual test. Exception in `%aftereach` is not affecting test results. For every failed execution of `%aftereach` a warning with exception stacktrace is displayed in the summary
17+
* A test package that is raising an exception in `%afterall` - all blocks of the package are executed, as the `%afterall` is the last step of package execution. Exception in `%afterall` is not affecting test results. A warning with exception stacktrace is displayed in the summary
1018

11-
Example:
12-
```
13-
Remove rooms by name
14-
Removes a room without content in it
15-
Does not remove room when it has content
16-
Raises exception when null room name given
17-
18-
Warnings:
19-
20-
1) test_remove_rooms_by_name - Afterall procedure failed:
21-
ORA-20001: Test exception
22-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 35
23-
ORA-06512: at line 6
24-
25-
Finished in ,044902 seconds
26-
3 tests, 0 failed, 0 errored, 0 ignored. 1 warning(s)
27-
```
2819

29-
* A test package that is raising an exception in `%beforeeach` - each `%test` is reported as failed
30-
* A test package that is raising an exception in `%aftereach` - `%test`s are reported normally, warnings are displayed in the summary
31-
32-
Example:
33-
```
20+
Example of reporting with exception thrown in `%beforetest`:
21+
````
3422
Remove rooms by name
35-
Removes a room without content in it
23+
Removes a room without content in it (FAILED - 1)
3624
Does not remove room when it has content
3725
Raises exception when null room name given
3826
39-
Warnings:
40-
41-
1) test_remove_rooms_by_name - Aftereach procedure failed:
42-
ORA-20001: Test exception
43-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
44-
ORA-06512: at line 6
45-
46-
2) test_remove_rooms_by_name - Aftereach procedure failed:
47-
ORA-20001: Test exception
48-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
49-
ORA-06512: at line 6
50-
51-
3) test_remove_rooms_by_name - Aftereach procedure failed:
52-
ORA-20001: Test exception
53-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
54-
ORA-06512: at line 6
27+
Failures:
5528
56-
Finished in ,05071 seconds
57-
3 tests, 0 failed, 0 errored, 0 ignored. 3 warning(s)
58-
```
59-
60-
* A test package that is raising an exception in test - the `%test` is reported as failed
29+
1) remove_empty_room
30+
31+
error: ORA-20001: Test exception
32+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 39
33+
ORA-06512: at line 6
34+
35+
Finished in ,039346 seconds
36+
3 tests, 0 failed, 1 errored, 0 ignored.
37+
````
6138

62-
Exampple:
39+
Example of reporting with exception thrown in `%test`:
6340
```
6441
Remove rooms by name
6542
Removes a room without content in it (FAILED - 1)
@@ -78,10 +55,8 @@ Finished in ,035726 seconds
7855
3 tests, 0 failed, 1 errored, 0 ignored.
7956
```
8057

81-
* A test package that is raising an exception in `%beforetest` - the `%test` is reported as failed
82-
83-
Example:
84-
````
58+
Example of reporting with exception thrown in `%aftertest`:
59+
```
8560
Remove rooms by name
8661
Removes a room without content in it (FAILED - 1)
8762
Does not remove room when it has content
@@ -92,30 +67,55 @@ Failures:
9267
1) remove_empty_room
9368
9469
error: ORA-20001: Test exception
95-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 39
70+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 42
9671
ORA-06512: at line 6
9772
98-
Finished in ,039346 seconds
73+
Finished in ,045523 seconds
9974
3 tests, 0 failed, 1 errored, 0 ignored.
100-
````
75+
```
10176

102-
* A test package that is raising an exception in `%aftertest` - the `%test` is reported as failed
77+
Example of reporting with exception thrown in `%aftereach`:
78+
```
79+
Remove rooms by name
80+
Removes a room without content in it
81+
Does not remove room when it has content
82+
Raises exception when null room name given
83+
84+
Warnings:
85+
86+
1) test_remove_rooms_by_name - Aftereach procedure failed:
87+
ORA-20001: Test exception
88+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
89+
ORA-06512: at line 6
90+
91+
2) test_remove_rooms_by_name - Aftereach procedure failed:
92+
ORA-20001: Test exception
93+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
94+
ORA-06512: at line 6
95+
96+
3) test_remove_rooms_by_name - Aftereach procedure failed:
97+
ORA-20001: Test exception
98+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 31
99+
ORA-06512: at line 6
100+
101+
Finished in ,05071 seconds
102+
3 tests, 0 failed, 0 errored, 0 ignored. 3 warning(s)
103+
```
103104

104-
Example:
105+
Example of reporting with exception thrown in `%afterall`:
105106
```
106107
Remove rooms by name
107-
Removes a room without content in it (FAILED - 1)
108+
Removes a room without content in it
108109
Does not remove room when it has content
109110
Raises exception when null room name given
110111
111-
Failures:
112+
Warnings:
112113
113-
1) remove_empty_room
114-
115-
error: ORA-20001: Test exception
116-
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 42
117-
ORA-06512: at line 6
118-
119-
Finished in ,045523 seconds
120-
3 tests, 0 failed, 1 errored, 0 ignored.
114+
1) test_remove_rooms_by_name - Afterall procedure failed:
115+
ORA-20001: Test exception
116+
ORA-06512: at "UT3.TEST_REMOVE_ROOMS_BY_NAME", line 35
117+
ORA-06512: at line 6
118+
119+
Finished in ,044902 seconds
120+
3 tests, 0 failed, 0 errored, 0 ignored. 1 warning(s)
121121
```

0 commit comments

Comments
 (0)