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
+15-8Lines changed: 15 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,15 @@ The annotation list is based on moder testing framework such as jUnit 5, RSpec.
5
5
6
6
Annotations allow to configure test infrastructure in a declarative way without anything stored in tables or config files. The framework runner scans the schema for all the suitable annotated packages, automatically configures suites, forms hierarchy from then and executes them.
7
7
8
-
# Example of annotated package
9
-
```
8
+
Annotations are case-insensitive. But it is recommended to use the lower-case standard as described in the documentation.
9
+
10
+
Annotation on procedure level must be placed directly before the procedure name.
11
+
12
+
Annotation `-- %suite` should be placed at the beginning of package specification. It is not required but highly recommended as a practice.
13
+
14
+
# Example of annotated test package
15
+
16
+
```sql
10
17
create or replace package test_pkg is
11
18
12
19
-- %suite(Name of suite)
@@ -51,19 +58,19 @@ create or replace package test_pkg is
51
58
end test_pkg;
52
59
```
53
60
54
-
#Annotations meaning
61
+
#Annotations description
55
62
56
-
| Annotation |Level|Describtion|
63
+
| Annotation |Level|Description|
57
64
| --- | --- | --- |
58
65
|`%suite(<description>)`| Package | Marks package to be a suite of tests This way all testing packages might be found in a schema. Optional schema discription can by provided, similar to `%displayname` annotation. |
59
-
|`%suitepath(<path>)`| Package | Similar to java package. The annotation allows logical grouping of suites into hierarcies. |
60
-
|`%displayname(<description>)`| Package/procedure | Human-familiar describtion of the suite/test. Syntax is based on jUnit annotation: `%displayname(Name of the suite/test)`|
61
-
|`%test(<description>)`| Procedure | Denotes that a method is a test method. Optional test discription can by provided, similar to `%displayname` annotation. |
66
+
|`%suitepath(<path>)`| Package | Similar to java package. The annotation allows logical grouping of suites into hierarchies. |
67
+
|`%displayname(<description>)`| Package/procedure | Human-familiar description of the suite/test. Syntax is based on jUnit annotation: `%displayname(Name of the suite/test)`|
68
+
|`%test(<description>)`| Procedure | Denotes that a method is a test method. Optional test description can by provided, similar to `%displayname` annotation. |
62
69
|`%beforeall`| Procedure | Denotes that the annotated procedure should be executed once before all elements of the current suite. |
63
70
|`%afterall`| Procedure | Denotes that the annotated procedure should be executed once after all elements of the current suite. |
64
71
|`%beforeeach`| Procedure | Denotes that the annotated procedure should be executed before each `%test` method in the current suite. |
65
72
|`%aftereach`| Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
66
73
|`%beforetest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
67
74
|`%aftertest(<procedure_name>)`| Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
68
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) |
69
-
|`%disable`| Package/procedure | Used to disable a suite or a test |
76
+
|`%disable`| Package/procedure | Used to disable a suite or a test |
Parameters `a_pattern` and `a_modifiers` represent a valid regexp pattern accepted by [Oracle regexp_like function](http://docs.oracle.com/database/121/SQLRF/conditions007.htm#SQLRF00501)
42
+
43
+
## equal
44
+
45
+
The equal matcher is a very restrictive matcher.
46
+
It only returns true, if compared data-types.
47
+
That means, that comparing varchar2 to a number will fail even if the varchar2 contains the same number.
48
+
This matcher is designed to capture changes of data-type, so that if you expect your variable to be number and is now something else,
49
+
the test will fail and give you early indication of potential problem.
The equal matcher accepts a_expected of following data-types.
58
+
-`anydata`
59
+
-`blob`
60
+
-`boolean`
61
+
-`clob`
62
+
-`date`
63
+
-`number`
64
+
-`sys_refcursor`
65
+
-`timestamp_unconstrained`
66
+
-`timestamp_tz_unconstrained`
67
+
-`timestamp_ltz_unconstrained`
68
+
-`varchar2`
69
+
-`yminterval_unconstrained`
70
+
-`dsinterval_unconstrained`
71
+
72
+
The second parameter decides on the behavior of `null=null` comparison (**this comparison by default is true!**)
73
+
74
+
75
+
A test procedure will contain one or more checks to verify the the test performed as expected. These checks are called assertion. utPLSQL provides a robust and extensible assertion library.
0 commit comments