| 1 |
Feature: Tag Expression |
| 2 |
|
| 3 |
As a tester |
| 4 |
I want to select a subset of all features/scenarios by using tags |
| 5 |
And I want to include and/or exclude some tags |
| 6 |
So that I can focus on the "important" scenarios (and features). |
| 7 |
|
| 8 |
. SPECIFICATION: |
| 9 |
. * a tag expression is a boolean expression |
| 10 |
. * a tag expression supports the operators: and, or, not |
| 11 |
. * a tag expression is structured as: |
| 12 |
. (or_expr1) and (or_expr2) and ... |
| 13 |
. |
| 14 |
. EXAMPLES: |
| 15 |
. | Tag logic | Tag expression | Comment | |
| 16 |
. | @foo | @foo | Select elements with @foo tag | |
| 17 |
. | @foo | foo | Same, '@' is optional. | |
| 18 |
. | not @foo | -@foo | Use minus for "not". | |
| 19 |
. | not @foo | ~foo | Same, use tilde instead of minus | |
| 20 |
. | @foo or @bar | @foo,@bar | Use comma for "or". | |
| 21 |
. | @foo and @bar | @foo @bar | Use space separated terms. | |
| 22 |
. | @foo or not @bar | @foo,-@bar | | |
| 23 |
. | @foo and not @bar | @foo -@bar | | |
| 24 |
|
| 25 |
|
| 26 |
Scenario: Select @foo |
| 27 |
Given the tag expression "@foo" |
| 28 |
Then the tag expression selects elements with tags: |
| 29 |
| tags | selected? | |
| 30 |
| | no | |
| 31 |
| @foo | yes | |
| 32 |
| @other | no | |
| 33 |
| @foo @other | yes | |
| 34 |
|
| 35 |
|
| 36 |
Scenario: Tag expression with 0..1 tags |
| 37 |
Given the model elements with name and tags: |
| 38 |
| name | tags | Comment | |
| 39 |
| S0 | | Untagged | |
| 40 |
| S1 | @foo | With 1 tag | |
| 41 |
| S2 | @other | | |
| 42 |
| S3 | @foo @other | With 2 tags | |
| 43 |
And note that "are all combinations of 0..2 tags" |
| 44 |
Then the tag expression selects model elements with: |
| 45 |
| tag expression | selected? | Case comment | |
| 46 |
| | S0, S1, S2, S3 | Select all (empty tag expression) | |
| 47 |
| @foo | S1, S3 | Select @foo | |
| 48 |
| -@foo | S0, S2 | not @foo, selects untagged elements | |
| 49 |
But note that "tag expression variants are also supported" |
| 50 |
And the tag expression selects model elements with: |
| 51 |
| tag expression | selected? | Case comment | |
| 52 |
| foo | S1, S3 | @foo: '@' is optional | |
| 53 |
| -foo | S0, S2 | not @foo: '@' is optional | |
| 54 |
| ~foo | S0, S2 | not @foo: tilde as minus | |
| 55 |
| ~@foo | S0, S2 | not @foo: '~@' is supported | |
| 56 |
|
| 57 |
|
| 58 |
Scenario: Tag expression with two tags (@foo, @bar) |
| 59 |
Given the model elements with name and tags: |
| 60 |
| name | tags | Comment | |
| 61 |
| S0 | | Untagged | |
| 62 |
| S1 | @foo | With 1 tag | |
| 63 |
| S2 | @bar | | |
| 64 |
| S3 | @other | | |
| 65 |
| S4 | @foo @bar | With 2 tags | |
| 66 |
| S5 | @foo @other | | |
| 67 |
| S6 | @bar @other | | |
| 68 |
| S7 | @foo @bar @other | With 3 tags | |
| 69 |
And note that "are all combinations of 0..3 tags" |
| 70 |
Then the tag expression selects model elements with: |
| 71 |
| tag expression | selected? | Case | |
| 72 |
| | S0, S1, S2, S3, S4, S5, S6, S7 | Select all | |
| 73 |
| @foo,@bar | S1, S2, S4, S5, S6, S7 | @foo or @bar | |
| 74 |
| @foo,-@bar | S0, S1, S3, S4, S5, S7 | @foo or not @bar | |
| 75 |
| -@foo,-@bar | S0, S1, S2, S3, S5, S6 | not @foo or @not @bar | |
| 76 |
| @foo @bar | S4, S7 | @foo and @bar | |
| 77 |
| @foo -@bar | S1, S5 | @foo and not @bar | |
| 78 |
| -@foo -@bar | S0, S3 | not @foo and not @bar | |
| 79 |
|
| 80 |
|
| 81 |
Scenario: Tag expression with three tags (@foo, @bar, @zap) |
| 82 |
Given the model elements with name and tags: |
| 83 |
| name | tags | Comment | |
| 84 |
| S0 | | Untagged | |
| 85 |
| S1 | @foo | With 1 tag | |
| 86 |
| S2 | @bar | | |
| 87 |
| S3 | @zap | | |
| 88 |
| S4 | @other | | |
| 89 |
| S5 | @foo @bar | With 2 tags | |
| 90 |
| S6 | @foo @zap | | |
| 91 |
| S7 | @foo @other | | |
| 92 |
| S8 | @bar @zap | | |
| 93 |
| S9 | @bar @other | | |
| 94 |
| S10 | @zap @other | | |
| 95 |
| S11 | @foo @bar @zap | With 3 tags | |
| 96 |
| S12 | @foo @bar @other | | |
| 97 |
| S13 | @foo @zap @other | | |
| 98 |
| S14 | @bar @zap @other | | |
| 99 |
| S15 | @foo @bar @zap @other | With 4 tags | |
| 100 |
And note that "are all combinations of 0..4 tags" |
| 101 |
Then the tag expression selects model elements with: |
| 102 |
| tag expression | selected? | Case | |
| 103 |
| @foo,@bar @zap | S6, S8, S11, S13, S14, S15 | (@foo or @bar) and @zap | |
| 104 |
| @foo,@bar -@zap | S1, S2, S5, S7, S9, S12 | (@foo or @bar) and not @zap | |
| 105 |
| @foo,-@bar @zap | S3, S6, S10, S11, S13, S15 | (@foo or not @bar) and @zap | |