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

Skip to content

Commit f227f17

Browse files
authored
Merge branch 'develop' into feature/color_reporter
2 parents 846a2ef + b6f2278 commit f227f17

7 files changed

Lines changed: 199 additions & 91 deletions

File tree

.travis/create_release_archive.sh

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mkdir release/source
1212
# Copy files to various directories
1313
cp -r docs release/docs/markdown
1414
cp -r site release/docs/html
15+
cp -r client_source release/client_source
1516
cp -r source release/source
1617
cp -r examples release/examples
1718
cp -r readme.md release/

docs/userguide/annotations.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ The annotation list is based on moder testing framework such as jUnit 5, RSpec.
55

66
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.
77

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
1017
create or replace package test_pkg is
1118

1219
-- %suite(Name of suite)
@@ -51,19 +58,19 @@ create or replace package test_pkg is
5158
end test_pkg;
5259
```
5360

54-
#Annotations meaning
61+
#Annotations description
5562

56-
| Annotation |Level| Describtion |
63+
| Annotation |Level| Description |
5764
| --- | --- | --- |
5865
| `%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. |
6269
| `%beforeall` | Procedure | Denotes that the annotated procedure should be executed once before all elements of the current suite. |
6370
| `%afterall` | Procedure | Denotes that the annotated procedure should be executed once after all elements of the current suite. |
6471
| `%beforeeach` | Procedure | Denotes that the annotated procedure should be executed before each `%test` method in the current suite. |
6572
| `%aftereach` | Procedure | Denotes that the annotated procedure should be executed after each `%test` method in the current suite. |
6673
| `%beforetest(<procedure_name>)` | Procedure | Denotes that mentioned procedure should be executed before the annotated `%test` procedure. |
6774
| `%aftertest(<procedure_name>)` | Procedure | Denotes that mentioned procedure should be executed after the annotated `%test` procedure. |
6875
| `%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 |

docs/userguide/assertions.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/userguide/expectations.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Concept of expectation and matcher
2+
3+
Validation of the code under test (the tested logic of procedure/function etc.) is performed by comparing the actual data against the expected data.
4+
To do that we use concept of expectation and a matcher to perform the check on the data.
5+
6+
It's best to give an example to get an idea what is what
7+
```sql
8+
begin
9+
ut.expect( 'the tested value' ).to_( equal('the expected value') );
10+
end;
11+
```
12+
13+
Expectation is a set of the expected value(s), actual values(s) and the matcher(s) to run on those values.
14+
15+
Matcher is defining the comparison operation to be performed on expected and actual values.
16+
17+
# List of currently build-in matchers
18+
- `match`
19+
- `equal`
20+
- `be_true`
21+
- `be_null`
22+
- `be_not_null`
23+
- `be_like`
24+
- `be_less_than`
25+
- `be_less_or_equal`
26+
- `be_greater_than`
27+
- `be_greater_or_equal`
28+
- `be_false`
29+
- `be_between`
30+
31+
## match
32+
Allows regexp_like validations to be executed against the following datatypes:
33+
- `clob`
34+
- `varchar2`
35+
36+
Usage:
37+
```sql
38+
ut.expect( a_actual ).to_( match( a_pattern in varchar2, a_modifiers in varchar2 := null) )
39+
```
40+
41+
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.
50+
51+
Usage:
52+
```sql
53+
ut.expect( a_actual ).to_( equal( a_expected {mulitple data-types}, a_nulls_are_equal boolean := null) )
54+
```
55+
56+
57+
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.
76+
77+
78+
TODO: Finish Expectations concepts

examples/between_string/test_betwnstr.pkg

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
create or replace package test_betwnstr as
22

3-
-- %suite
4-
-- %displayname(Between string function)
3+
-- %suite(Between string function)
54

6-
-- %test
7-
-- %displayname(Returns substring from start position to end position)
5+
-- %test(Returns substring from start position to end position)
86
procedure normal_case;
97

10-
-- %test
11-
-- %displayname(Returns substring when start position is zero)
8+
-- %test(Returns substring when start position is zero)
129
procedure zero_start_position;
1310

14-
-- %test
15-
-- %displayname(Returns string until end if end position is greated than string length)
11+
-- %test(Returns string until end if end position is greater than string length)
1612
procedure big_end_position;
1713

18-
-- %test
19-
-- %displayname(Returns null for null inlut srting value)
14+
-- %test(Returns null for null input string value)
2015
procedure null_string;
2116
end;
2217
/
2318
create or replace package body test_betwnstr as
2419

2520
procedure normal_case is
2621
begin
27-
ut.expect( betwnstr( '1234567', 2, 5 ) ).to_( equal('2345') );
22+
ut.expect( betwnstr( '1234567', 2, 5 ) ).to_equal('2345');
2823
end;
2924

3025
procedure zero_start_position is
3126
begin
3227
ut.expect( betwnstr( '1234567', 0, 5 ) ).to_( equal('12345') );
3328
end;
3429

35-
3630
procedure big_end_position is
3731
begin
3832
ut.expect( betwnstr( '1234567', 0, 500 ) ).to_( equal('1234567') );

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ site_description: utPLSQL Documenation Powerful Unit Testing Framework for Oracl
66
copyright: Copyright &copy; 2016 - utPLSQL Team
77
repo_url: https://github.com/utplsql/utplsql/
88
theme: mkdocs
9+
use_directory_urls: false
910
strict: true
1011

1112
pages:
@@ -14,7 +15,7 @@ pages:
1415
- Installation: userguide/install.md
1516
- Getting Started: userguide/getting-started.md
1617
- Annotations: userguide/annotations.md
17-
- Assertions: userguide/assertions.md
18+
- Expectations: userguide/expectations.md
1819
- Testing Best Pracitces: userguide/best-practices.md
1920
- Upgrade utPLSQL : userguide/upgrade.md
2021
- About:

0 commit comments

Comments
 (0)