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/expectations.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Expectation is a combination of:
24
24
- the expected value
25
25
- optional custom message for the expectation
26
26
- the matcher used to perform comparison
27
-
-them matcher parameters (actual value), depending on the matcher type
27
+
-the matcher parameters (actual value), depending on the matcher type
28
28
29
29
30
30
Matcher defines the comparison operation to be performed on expected (and actual) value.
@@ -88,7 +88,7 @@ There are two ways to use expectations:
88
88
- without invoking the utPLSQL framework - running expectations standalone
89
89
90
90
## Running expectations within utPLSQL framework
91
-
When expectations are ran a part of test suite, the framework tracks:
91
+
When expectations are ran as a part of a test suite, the framework tracks:
92
92
- status of each expectation
93
93
- outcomes (messages) produced by each expectation
94
94
- call stack to each expectation
@@ -161,7 +161,7 @@ When expectations are invoked outside of utPLSQL framework the outputs from expe
161
161
> Source code of the line which called the expectation is only reported when the line is part of in-database code (package) and the user calling expectation has privileges to see that source code.
162
162
163
163
**Important**
164
-
> Please do not use expectations as part of your production code. They are not designed to be used as part ot your code. Expectations are meant to be used only as part of your day-to-day testing activities.
164
+
> Please do not use expectations as part of your production code. They are not designed to be used as part of your code. Expectations are meant to be used only as part of your day-to-day testing activities.
165
165
166
166
**Note:**
167
167
> The examples in the document will be only using standalone expectations, to keep the document brief.
@@ -186,7 +186,7 @@ utPLSQL provides the following matchers to perform checks on the expected and ac
Since NULL is neither *true* nor *false*, both expectations will report failure.
314
314
315
+
**Note:**
316
+
Beware that `not_to_contain` is not a simple negation of `to_contain`: `not_to_contain` checks whether the actual and the expected set are disjoint.
317
+
315
318
# Supported data types
316
319
317
320
The matrix below illustrates the data types supported by different matchers.
@@ -386,7 +389,7 @@ For more details see documentation of the [`--%throws` annotation.](annotations.
386
389
387
390
# Matchers
388
391
10000
389
-
You can choose different matchers to validate the your PL/SQL code is working as expected.
392
+
You can choose different matchers to validate that your PL/SQL code is working as expected.
390
393
391
394
392
395
## be_between
@@ -759,7 +762,7 @@ FAILURE
759
762
## have_count
760
763
Unary matcher that validates if the provided dataset count is equal to expected value.
761
764
762
-
Can be used with `refcursor`, `json`or `table type`
765
+
Can be used with `refcursor`, `json`or `table type`
763
766
764
767
Usage:
765
768
```sql
@@ -827,8 +830,8 @@ FAILURE
827
830
```
828
831
829
832
## equal
830
-
The equal matcher is very restrictive. Test using this matcher succeeds only when the compared data-types are exactly the same.
831
-
If you are comparing `varchar2` to a `number` will fail even if the text contains the same numeric value as the number.
833
+
The `equal` matcher is very restrictive. Test using this matcher succeeds only when the compared data-types are exactly the same.
834
+
If you are comparing a `varchar2` to a `number`, it will fail even if the text contains the same numeric value as the number.
832
835
The matcher will also fail when comparing a `timestamp` to a `timestamp with timezone` data-type etc.
833
836
834
837
The matcher enables detection of data-type changes.
@@ -916,13 +919,13 @@ To change the behavior of `NULL = NULL` comparison pass the `a_nulls_are_equal =
916
919
917
920
This matcher supports only compound data-types comparison. It check if the actual set contains all values of expected subset.
918
921
919
-
When comparing data using `contain` matcher, the data-types of columns for compared compound types must be exactly the same.
922
+
When comparing data using the `contain` matcher, the data-types of columns for compared compound types must be exactly the same.
920
923
921
-
The matcher supports all advanced comparison options as `equal` like: `include` , `exclude`, `join_by` etc..
924
+
The matcher supports all advanced comparison options supported by `equal` like: `include` , `exclude`, `join_by` etc..
922
925
923
926
The matcher is successful when actual data set contains all of the values from expected results.
924
927
925
-
The matcher will cause a test to fail if actual data set does not contain any of expected values.
928
+
The matcher will cause a test to fail if actual data set does not contain some of expected values.
926
929
927
930

928
931
@@ -1108,7 +1111,7 @@ utPLSQL is capable of comparing compound data-types including:
1108
1111
- Columns in compound data are compared as **ordered list of elements** by default. Use `unordered_columns` option when order of columns in cursor is not relevant
1109
1112
- Comparison of compound data is data-type aware. So a column `ID NUMBER` in a cursor is not the same as `ID VARCHAR2(100)`, even if they both hold the same numeric values.
1110
1113
- Comparison of cursor columns containing `DATE` will only compare date part **and ignore time** by default. See [Comparing cursor data containing DATE fields](#comparing-cursor-data-containing-date-fields) to check how to enable date-time comparison in cursors.
1111
-
- Comparison of cursor returning `TIMESTAMP` **columns** against cursor returning `TIMESTAMP` **bind variables** requires variables to be casted to proper precision. This is an Oracle SQL - PLSQL compatibility issue and usage of CAST is the only known workaround for now. See [Comparing cursor data containing TIMESTAMP bind variables](#comparing-cursor-data-containing-timestamp-bind-variables) for examples.
1114
+
- Comparison of cursor returning `TIMESTAMP` **columns** against cursor returning `TIMESTAMP` **bind variables** requires variables to be cast to proper precision. This is an Oracle SQL - PLSQL compatibility issue and usage of CAST is the only known workaround for now. See [Comparing cursor data containing TIMESTAMP bind variables](#comparing-cursor-data-containing-timestamp-bind-variables) for examples.
1112
1115
- To compare nested table/varray type you need to convert it to `anydata` by using `anydata.convertCollection()`
1113
1116
- To compare object type you need to convert it to `anydata` by using `anydata.convertObject()`
1114
1117
- It is possible to compare PL/SQL records, collections, varrays and associative arrays. To compare this types of data, use cursor comparison feature of utPLSQL and TABLE operator in SQL query
@@ -1541,7 +1544,7 @@ drop table events;
1541
1544
1542
1545
In the above example:
1543
1546
- The first expectation is successful, as the `l_expected` cursor contains different date-time then the cursor returned by `get_events` function call
1544
-
- The second expectation fails, as the column `event_date` will get compared as DATE without TIME (suing default current session NLS date format)
1547
+
- The second expectation fails, as the column `event_date` will get compared as DATE without TIME (using default current session NLS date format)
0 commit comments