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

Skip to content

Commit f714499

Browse files
committed
Update docs and tests
1 parent dbbf197 commit f714499

3 files changed

Lines changed: 34 additions & 3 deletions

File tree

docs/userguide/annotations.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,9 @@ or
12451245

12461246
Tags are defined as a coma separated list. When executing a tests filtering by tag utPLSQL will find all tests associated with a given tag and execute it. It will apply `OR` logic when resolving a tags so any tests / suites that got matching at least one tag will get executed.
12471247

1248-
When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent.
1248+
When a suite gets tagged all of its children will automatically inherit a tag and get executed along the parent. Parent suit tests are not executed. but a suitepath hierarchy is kept.
1249+
1250+
Sample tag package.
12491251

12501252
```sql
12511253
create or replace PACKAGE ut_sample_test IS
@@ -1257,6 +1259,10 @@ create or replace PACKAGE ut_sample_test IS
12571259
--%tag(test1,sample)
12581260
PROCEDURE ut_refcursors1;
12591261

1262+
--%test(Compare Ref Cursors #2)
1263+
--%tag(test2,sample)
1264+
PROCEDURE ut_refcursors2;
1265+
12601266
END ut_sample_test;
12611267
/
12621268

@@ -1271,7 +1277,17 @@ create or replace PACKAGE BODY ut_sample_test IS
12711277

12721278
ut.expect(v_actual).to_equal(v_expected);
12731279
END;
1280+
1281+
PROCEDURE ut_refcursors2 IS
1282+
v_actual SYS_REFCURSOR;
1283+
v_expected SYS_REFCURSOR;
1284+
BEGIN
1285+
open v_expected for select 1 as test from dual;
1286+
open v_actual for select 2 as test from dual;
12741287

1288+
ut.expect(v_actual).to_equal(v_expected);
1289+
END;
1290+
12751291
END ut_sample_test;
12761292
/
12771293
```
@@ -1280,7 +1296,8 @@ Execution of the test is done by using a new parameter `a_tags`
12801296

12811297
```sql
12821298
select * from table(ut.run(a_path => 'ut_sample_test',a_tags => 'suite1'));
1283-
select * from table(ut.run(a_tags => 'suite1'));
1299+
select * from table(ut.run(a_tags => 'test1,test2'));
1300+
select * from table(ut.run(a_tags => 'sample'));
12841301

12851302
begin
12861303
ut.run(a_path => 'ut_sample_test',a_tags => 'suite1');

test/ut3_user/api/test_ut_run.pkb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,17 @@ Failures:%
860860
ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
861861
end;
862862

863+
procedure suite_with_tag_parent is
864+
l_results clob;
865+
begin
866+
ut3_tester_helper.run_helper.run(a_tags => 'suite2');
867+
l_results := ut3_tester_helper.main_helper.get_dbms_output_as_clob();
868+
--Assert
869+
ut.expect( l_results ).to_be_like( '%test_package_1%' );
870+
ut.expect( l_results ).to_be_like( '%test_package_2%' );
871+
ut.expect( l_results ).not_to_be_like( '%test_package_3%' );
872+
end;
873+
863874
procedure test_nonexists_tag is
864875
l_results clob;
865876
l_exp_message varchar2(4000);

test/ut3_user/api/test_ut_run.pks

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ create or replace package test_ut_run is
186186
--%test(Execute suite and all of its children)
187187
procedure suite_with_children_tag;
188188

189+
--%test(Execute suite and parents)
190+
procedure suite_with_tag_parent;
191+
189192
--%test(Execute test for non existing tag)
190193
procedure test_nonexists_tag;
191194

@@ -215,7 +218,7 @@ create or replace package test_ut_run is
215218

216219
--%test(Runs tests from given paths with paths list and a tag)
217220
procedure tag_run_func_path_list;
218-
221+
219222
--%endcontext
220223

221224
end;

0 commit comments

Comments
 (0)