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

Skip to content

Commit f48e7e5

Browse files
committed
Improve documentation around tags
1 parent 49c0768 commit f48e7e5

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

docs/userguide/annotations.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ Finished in .035261 seconds
12251225

12261226
### Tags
12271227

1228-
Tag is a label attached to the test or a suite. It is used for identification and execution a group of tests / suites that share same tag.
1228+
Tag is a label attached to the test or a suite. It is used for identification and execution of a group of tests / suites that share the same tag.
12291229

12301230
It allows for grouping of tests / suites using various categorization and place tests / suites in multiple buckets. Same tests can be grouped with other tests based on the functionality , frequency, type of output etc.
12311231

@@ -1244,15 +1244,15 @@ or
12441244

12451245
Tags are defined as a comma separated list within the `--%tags` annotation.
12461246

1247-
When executing a test run with tag filter applied, framework will find all tests associated with given tags and execute them.
1248-
Framework applies `OR` logic to all specified tags so any test / suite that matches at least one tag will be included in the test run.
1247+
When executing a test run with tag filter applied, the framework will find all tests associated with the given tags and execute them.
1248+
The framework applies `OR` logic to all specified tags so any test / suite that matches at least one tag will be included in the test run.
12491249

1250-
When a suite/context is tagged all of its children will automatically inherit a tag and get executed along with the parent. Parent suite tests are not executed, but a suitepath hierarchy is kept.
1250+
When a suite/context is tagged, all of its children will automatically inherit the tag and get executed along with the parent. Parent suite tests are not executed, but a suitepath hierarchy is kept.
12511251

12521252

12531253
Sample test suite package with tags.
12541254
```sql
1255-
create or replace package ut_sample_test IS
1255+
create or replace package ut_sample_test is
12561256

12571257
--%suite(Sample Test Suite)
12581258
--%tags(api)
@@ -1289,7 +1289,7 @@ end ut_sample_test;
12891289
/
12901290
```
12911291

1292-
Execution of the test is done by using a parameter `a_tags`
1292+
Execution of the test is done by using the parameter `a_tags`
12931293

12941294
```sql
12951295
select * from table(ut.run(a_path => 'ut_sample_test',a_tags => 'api'));
@@ -1306,6 +1306,18 @@ select * from table(ut.run(a_tags => 'fast'));
13061306
```
13071307
The above call will execute both `ut_sample_test.ut_refcursors1` and `ut_sample_test.ut_test` tests, as both tests are tagged with `fast`
13081308

1309+
#### Tag naming convention
1310+
1311+
Tags must follow the below naming convention:
1312+
1313+
- tag is case sensitive
1314+
- tag can contain special characters like `$#/\?-!` etc.
1315+
- tag cannot be an empty string
1316+
- tag cannot start with a dash, e.g. `-some-stuff` is **not** a valid tag
1317+
- tag cannot contain spaces, e.g. `test of batch`. To create a multi-word tag use underscores or dashes, e.g. `test_of_batch`, `test-of-batch`
1318+
- leading and trailing spaces are ignored in tag name, e.g. `--%tags( tag1 , tag2 )` becomes `tag1` and `tag2` tag names
1319+
1320+
13091321
#### Excluding tests/suites by tags
13101322

13111323
It is possible to exclude parts of test suites with tags.
@@ -1316,18 +1328,9 @@ Examples (based on above sample test suite)
13161328
```sql
13171329
select * from table(ut.run(a_tags => 'api,fast,-complex'));
13181330
```
1319-
The above call will execute all suites/contexts/tests that are marked with any of tags `api` or `fast` except those suites/contexts/tests that are marked as `complex`
1331+
The above call will execute all suites/contexts/tests that are marked with any of tags `api` or `fast` except those suites/contexts/tests that are marked as `complex`.
13201332
Given the above example package `ut_sample_test`, only `ut_sample_test.ut_test` will be executed.
13211333

1322-
**Note:**
1323-
Tags must follow the below naming convention:
1324-
1325-
- tag is case sensitive
1326-
- tag can contain special characters like `$#/\?-!` etc.
1327-
- tag cannot be an empty string
1328-
- tag cannot start with a dash e.g. `-some-stuff` is **not** a valid tag
1329-
- tag cannot contain spaces e.g. `test of batch`. To create a multi-word tag use underscores or dashes e.g. `test_of_batch`, `test-of-batch`
1330-
- leading and trailing spaces are ignored in tag name e.g. `--%tags( tag1 , tag2 )` becomes `tag1` and `tag2` tag names
13311334

13321335

13331336
### Suitepath

docs/userguide/running-unit-tests.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ select * from table(ut.run('hr.test_apply_bonus', a_random_test_order_seed => 30
284284
285285
# Run by Tags
286286

287-
In addition to the path, you can filter the tests to be run by specifying tags. Tags are defined in the test with the `--%tags`-annotation ([Read more](annotations.md#tags)).
288-
Multiple tags are separated by comma. If multiple tags are set, all tests with __any__ of them specified are run.
287+
In addition to the path, you can filter the tests to be run by specifying tags. Tags are defined in the test / context / suite with the `--%tags`-annotation ([Read more](annotations.md#tags)).
288+
Multiple tags are separated by comma.
289+
The framework applies `OR` logic to all specified tags so any test / suite that matches at least one tag will be included in the test run.
289290

290291
```sql
291292
begin
@@ -296,6 +297,11 @@ end;
296297
select * from table(ut.run('hr.test_apply_bonus', a_tags => 'suite1'))
297298
```
298299

300+
You can also exclude specific tags by adding a `-` (dash) in front of the tag
301+
302+
```sql
303+
select * from table(ut.run('hr.test_apply_bonus', a_tags => '-suite1'))
304+
```
299305

300306
# Keeping uncommitted data after test-run
301307

0 commit comments

Comments
 (0)