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