| 1 |
Feature: Runner Tag logic |
| 2 |
|
| 3 |
As a tester |
| 4 |
I want to select scenarios using logical AND/OR of tags |
| 5 |
In order to conveniently run subsets of these scenarios |
| 6 |
|
| 7 |
. SPECIFICATION: Tag logic |
| 8 |
. See "tag_expression.feature" description. |
| 9 |
. |
| 10 |
. RELATED: |
| 11 |
. * tag_expression.feature |
| 12 |
|
| 13 |
Scenario: Select scenarios with 1 tag (@foo) |
| 14 |
Given a behave model with: |
| 15 |
| statement | name | tags | Comment | |
| 16 |
| Scenario | S0 | | Untagged | |
| 17 |
| Scenario | S1 | @foo | With 1 tag | |
| 18 |
| Scenario | S2 | @other | | |
| 19 |
| Scenario | S3 | @foo @other | With 2 tags | |
| 20 |
And note that "are all combinations of 0..2 tags" |
| 21 |
When I run the behave model with "tags" |
| 22 |
Then the following scenarios are selected with cmdline: |
| 23 |
| cmdline | selected? | Logic comment | |
| 24 |
| | S0, S1, S2, S3 | ALL, no selector | |
| 25 |
| --tags=@foo | S1, S3 | @foo | |
| 26 |
| --tags=-@foo | S0, S2 | not @foo | |
| 27 |
|
| 28 |
|
| 29 |
Scenario: Use other tag expression variants |
| 30 |
Given a behave model with: |
| 31 |
| statement | name | tags | Comment | |
| 32 |
| Scenario | S0 | | Untagged | |
| 33 |
| Scenario | S1 | @foo | With 1 tag | |
| 34 |
| Scenario | S2 | @other | | |
| 35 |
| Scenario | S3 | @foo @other | With 2 tags | |
| 36 |
Then the following scenarios are selected with cmdline: |
| 37 |
| cmdline | selected? | Logic comment | |
| 38 |
| --tags=foo | S1, S3 | @foo, without optional @ | |
| 39 |
| --tags=-foo | S0, S2 | not @foo, without optional @ | |
| 40 |
| --tags=~foo | S0, S2 | not @foo, with tilde as minus | |
| 41 |
| --tags=~@foo | S0, S2 | not @foo, with tilde and @ | |
| 42 |
And note that "these tag expression variants can also be used" |
| 43 |
|
| 44 |
|
| 45 |
Scenario: Select scenarios with 2 tags (@foo, @bar) |
| 46 |
Given a behave model with: |
| 47 |
| statement | name | tags | Comment | |
| 48 |
| Scenario | S0 | | Untagged | |
| 49 |
| Scenario | S1 | @foo | With a tag | |
| 50 |
| Scenario | S2 | @bar | | |
| 51 |
| Scenario | S3 | @other | | |
| 52 |
| Scenario | S4 | @foo @bar | With 2 tags | |
| 53 |
| Scenario | S5 | @foo @other | | |
| 54 |
| Scenario | S6 | @bar @other | | |
| 55 |
| Scenario | S7 | @foo @bar @other | With 3 tags | |
| 56 |
And note that "are all combinations of 0..3 tags" |
| 57 |
When I run the behave model with "tags" |
| 58 |
Then the following scenarios are selected with cmdline: |
| 59 |
| cmdline | selected? | Logic comment | |
| 60 |
| | S0, S1, S2, S3, S4, S5, S6, S7 | ALL, no selector | |
| 61 |
| --tags=@foo,@bar | S1, S2, S4, S5, S6, S7 | @foo or @bar | |
| 62 |
| --tags=@foo,-@bar | S0, S1, S3, S4, S5, S7 | @foo or not @bar | |
| 63 |
| --tags=-@foo,-@bar | S0, S1, S2, S3, S5, S6 | not @foo or not @bar | |
| 64 |
| --tags=@foo --tags=@bar | S4, S7 | @foo and @bar | |
| 65 |
| --tags=@foo --tags=-@bar | S1, S5 | @foo and not @bar | |
| 66 |
| --tags=-@foo --tags=-@bar | S0, S3 | not @foo and not @bar | |
| 67 |
|