| 1 |
Feature: Default Tags |
| 2 |
|
| 3 |
As a tester |
| 4 |
I want to define a number of default tags in a configuration file |
| 5 |
So that I do not have to specify these tags each time on the command-line. |
| 6 |
|
| 7 |
. NOTES: |
| 8 |
. * default tags are normally used to exclude/disable tag(s) |
| 9 |
. * command-line tags override the default tags |
| 10 |
. * default tags can be disabled by using the following expression |
| 11 |
. on the command-line: behave --tags=-xxx ... (where xxx is an unknown tag) |
| 12 |
|
| 13 |
|
| 14 |
@setup |
| 15 |
Scenario: Test Setup |
| 16 |
Given a new working directory |
| 17 |
And a file named "features/one.feature" with: |
| 18 |
""" |
| 19 |
Feature: |
| 20 |
@not_implemented |
| 21 |
Scenario: Alice |
| 22 |
Given missing step passes |
| 23 |
|
| 24 |
@foo |
| 25 |
Scenario: Bob |
| 26 |
Given another step passes |
| 27 |
Then a step passes |
| 28 |
""" |
| 29 |
And a file named "features/steps/passing_steps.py" with: |
| 30 |
""" |
| 31 |
from behave import step |
| 32 |
|
| 33 |
@step('{word:w} step passes') |
| 34 |
def step_passes(context, word): |
| 35 |
pass |
| 36 |
""" |
| 37 |
|
| 38 |
Scenario: Use default tags with one tag |
| 39 |
Given a file named "behave.ini" with: |
| 40 |
""" |
| 41 |
[behave] |
| 42 |
show_skipped = false |
| 43 |
default_tags = -@not_implemented |
| 44 |
""" |
| 45 |
When I run "behave -f plain features" |
| 46 |
Then it should pass with: |
| 47 |
""" |
| 48 |
1 scenario passed, 0 failed, 1 skipped |
| 49 |
2 steps passed, 0 failed, 1 skipped, 0 undefined |
| 50 |
""" |
| 51 |
And the command output should contain "Scenario: Bob" |
| 52 |
But the command output should not contain "Scenario: Alice" |
| 53 |
|
| 54 |
|
| 55 |
Scenario: Override default tag on command-line |
| 56 |
Given a file named "behave.ini" with: |
| 57 |
""" |
| 58 |
[behave] |
| 59 |
show_skipped = false |
| 60 |
default_tags = -@not_implemented |
| 61 |
""" |
| 62 |
When I run "behave -f plain --tags=not_implemented features" |
| 63 |
Then it should pass with: |
| 64 |
""" |
| 65 |
1 scenario passed, 0 failed, 1 skipped |
| 66 |
1 step passed, 0 failed, 2 skipped, 0 undefined |
| 67 |
""" |
| 68 |
And the command output should contain "Scenario: Alice" |
| 69 |
But the command output should not contain "Scenario: Bob" |
| 70 |
|
| 71 |
Scenario: Use default tags with two tags |
| 72 |
Given a file named "behave.ini" with: |
| 73 |
""" |
| 74 |
[behave] |
| 75 |
show_skipped = false |
| 76 |
default_tags = -@not_implemented -@xfail |
| 77 |
# tag logic := not @not_implemented and not @xfail |
| 78 |
""" |
| 79 |
When I run "behave -f plain features" |
| 80 |
Then it should pass with: |
| 81 |
""" |
| 82 |
1 scenario passed, 0 failed, 1 skipped |
| 83 |
2 steps passed, 0 failed, 1 skipped, 0 undefined |
| 84 |
""" |
| 85 |
And the command output should contain "Scenario: Bob" |
| 86 |
But the command output should not contain "Scenario: Alice" |
| 87 |
|
| 88 |
|
| 89 |
Scenario: Override default tags on command-line |
| 90 |
Given a file named "behave.ini" with: |
| 91 |
""" |
| 92 |
[behave] |
| 93 |
show_skipped = false |
| 94 |
default_tags = -@not_implemented -@xfail |
| 95 |
# tag logic := not @not_implemented and not @xfail |
| 96 |
""" |
| 97 |
When I run "behave -f plain --tags=not_implemented,foo features" |
| 98 |
Then it should pass with: |
| 99 |
""" |
| 100 |
2 scenarios passed, 0 failed, 0 skipped |
| 101 |
3 steps passed, 0 failed, 0 skipped, 0 undefined |
| 102 |
""" |
| 103 |
And the command output should contain "Scenario: Alice" |
| 104 |
But the command output should contain "Scenario: Bob" |