| 1 |
@sequential |
| 2 |
Feature: Tags Formatter (Tag Counts) |
| 3 |
|
| 4 |
As a tester |
| 5 |
I want to obtain a quick overview which tags are used (and how often) |
| 6 |
So that I can better use tags on command-line |
| 7 |
|
| 8 |
NOTE: Primarily intended for dry-run mode. |
| 9 |
|
| 10 |
@setup |
| 11 |
Scenario: Feature Setup |
| 12 |
Given a new working directory |
| 13 |
And a file named "features/steps/steps.py" with: |
| 14 |
""" |
| 15 |
from behave import step |
| 16 |
|
| 17 |
@step('a step passes') |
| 18 |
def step_passes(context): |
| 19 |
pass |
| 20 |
""" |
| 21 |
And a file named "features/alice.feature" with: |
| 22 |
""" |
| 23 |
@one |
| 24 |
Feature: Alice |
| 25 |
|
| 26 |
@setup |
| 27 |
Scenario: Setup Feature |
| 28 |
Given a step passes |
| 29 |
|
| 30 |
@wip |
| 31 |
Scenario: A1 with tags: @wip (inherited: @one) |
| 32 |
Given a step passes |
| 33 |
|
| 34 |
@foo |
| 35 |
@wip |
| 36 |
Scenario: A2 with tags: @foo, @wip (inherited: @one) |
| 37 |
When a step passes |
| 38 |
|
| 39 |
@foo @bar |
| 40 |
Scenario: A3 with tags: @foo, @bar (inherited: @one) |
| 41 |
Then a step passes |
| 42 |
""" |
| 43 |
And a file named "features/bob.feature" with: |
| 44 |
""" |
| 45 |
@two |
| 46 |
Feature: Bob |
| 47 |
|
| 48 |
Scenario: B1 without tags (inherited: @two) |
| 49 |
Given a step passes |
| 50 |
|
| 51 |
@foo @one |
| 52 |
Scenario: B2 with tags: @foo, @one (inherited: @two) |
| 53 |
When a step passes |
| 54 |
""" |
| 55 |
|
| 56 |
|
| 57 |
Scenario: Use Tags formatter to get an overview of used tags |
| 58 |
When I run "behave -f tags --dry-run features/" |
| 59 |
Then it should pass with: |
| 60 |
""" |
| 61 |
0 features passed, 0 failed, 0 skipped, 2 untested |
| 62 |
0 scenarios passed, 0 failed, 0 skipped, 6 untested |
| 63 |
""" |
| 64 |
And the command output should contain: |
| 65 |
""" |
| 66 |
TAG COUNTS (alphabetically sorted): |
| 67 |
@bar 1 (used for scenario) |
| 68 |
@foo 3 (used for scenario) |
| 69 |
@one 2 (used for feature: 1, scenario: 1) |
| 70 |
@setup 1 (used for scenario) |
| 71 |
@two 1 (used for feature) |
| 72 |
@wip 2 (used for scenario) |
| 73 |
""" |
| 74 |
But note that "tags inherited from its feature are (normally) not counted." |
| 75 |
|
| 76 |
|
| 77 |
Scenario: Use Tags formatter together with another formatter |
| 78 |
When I run "behave -f tags -f plain -T features/" |
| 79 |
Then it should pass with: |
| 80 |
""" |
| 81 |
2 features passed, 0 failed, 0 skipped |
| 82 |
6 scenarios passed, 0 failed, 0 skipped |
| 83 |
""" |
| 84 |
And the command output should contain: |
| 85 |
""" |
| 86 |
Feature: Alice |
| 87 |
|
| 88 |
Scenario: Setup Feature |
| 89 |
Given a step passes ... passed |
| 90 |
|
| 91 |
Scenario: A1 with tags: @wip (inherited: @one) |
| 92 |
Given a step passes ... passed |
| 93 |
|
| 94 |
Scenario: A2 with tags: @foo, @wip (inherited: @one) |
| 95 |
When a step passes ... passed |
| 96 |
|
| 97 |
Scenario: A3 with tags: @foo, @bar (inherited: @one) |
| 98 |
Then a step passes ... passed |
| 99 |
|
| 100 |
Feature: Bob |
| 101 |
|
| 102 |
Scenario: B1 without tags (inherited: @two) |
| 103 |
Given a step passes ... passed |
| 104 |
|
| 105 |
Scenario: B2 with tags: @foo, @one (inherited: @two) |
| 106 |
When a step passes ... passed |
| 107 |
|
| 108 |
TAG COUNTS (alphabetically sorted): |
| 109 |
@bar 1 (used for scenario) |
| 110 |
@foo 3 (used for scenario) |
| 111 |
@one 2 (used for feature: 1, scenario: 1) |
| 112 |
@setup 1 (used for scenario) |
| 113 |
@two 1 (used for feature) |
| 114 |
@wip 2 (used for scenario) |
| 115 |
""" |
| 116 |
|
| 117 |
Scenario: Use Tags formatter when tags are selected |
| 118 |
When I run "behave -f tags --tags=@setup,@wip features/" |
| 119 |
Then it should pass with: |
| 120 |
""" |
| 121 |
1 feature passed, 0 failed, 1 skipped |
| 122 |
3 scenarios passed, 0 failed, 3 skipped |
| 123 |
""" |
| 124 |
And the command output should contain: |
| 125 |
""" |
| 126 |
TAG COUNTS (alphabetically sorted): |
| 127 |
@bar 1 (used for scenario) |
| 128 |
@foo 3 (used for scenario) |
| 129 |
@one 2 (used for feature: 1, scenario: 1) |
| 130 |
@setup 1 (used for scenario) |
| 131 |
@two 1 (used for feature) |
| 132 |
@wip 2 (used for scenario) |
| 133 |
""" |
| 134 |
And note that "all tags are detected even from skipped features and scenarios" |