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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
@issue
Feature: Issue #330: Skipped scenarios are included in junit reports when --no-skipped is used
@setup
Scenario: Feature Setup
Given a new working directory
And a file named "features/steps/steps.py" with:
"""
from behave import step
@step('{word:w} step passes')
def step_passes(context, word):
pass
"""
And a file named "features/alice.feature" with:
"""
@tag1
Feature: Alice
Scenario: Alice1
Given a step passes
"""
And a file named "features/bob.feature" with:
"""
Feature: Bob
Scenario: Bob1
Given another step passes
"""
And a file named "features/charly.feature" with:
"""
Feature: Charly
@tag1
Scenario: Charly1
Given some step passes
Scenario: Charly2
When another step passes
"""
And a file named "alice_and_bob.featureset" with:
"""
features/alice.feature
features/bob.feature
"""
And a file named "behave.ini" with:
"""
[behave]
default_format = plain
junit_directory = test_results
[behave.userdata]
behave.reporter.junit.show_timestamp = false
behave.reporter.junit.show_hostname = false
"""
Scenario: Junit report for skipped feature is not created with --no-skipped
When I run "behave --junit -t @tag1 --no-skipped @alice_and_bob.featureset"
Then it should pass with:
"""
1 feature passed, 0 failed, 1 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-bob.xml" does not exist
And the command output should contain:
"""
Feature: Alice
Scenario: Alice1
Given a step passes ... passed
"""
But the command output should not contain "Feature: Bob"
And note that "bob.feature is skipped"
@not.with_python.version=3.8
Scenario: Junit report for skipped feature is created with --show-skipped
When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset"
Then it should pass with:
"""
1 feature passed, 0 failed, 1 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-bob.xml" exists
And the file "test_results/TESTS-bob.xml" should contain:
"""
<testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0">
"""
@use.with_python.version=3.8
Scenario: Junit report for skipped feature is created with --show-skipped
When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset"
Then it should pass with:
"""
1 feature passed, 0 failed, 1 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-bob.xml" exists
And the file "test_results/TESTS-bob.xml" should contain:
"""
<testsuite name="bob.Bob" tests="1" errors="0" failures="0" skipped="1" time="0.0">
"""
# -- HINT FOR: Python < 3.8
# <testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0">
@not.with_python.version=3.8
Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped
When I run "behave --junit -t @tag1 --no-skipped"
Then it should pass with:
"""
2 features passed, 0 failed, 1 skipped
2 scenarios passed, 0 failed, 2 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-charly.xml" exists
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testsuite errors="0" failures="0" name="charly.Charly" skipped="0" tests="1"
"""
And the file "test_results/TESTS-charly.xml" should not contain:
"""
<testcase classname="charly.Charly" name="Charly2"
"""
And note that "Charly2 is the skipped scenarion in charly.feature"
@use.with_python.version=3.8
Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped
When I run "behave --junit -t @tag1 --no-skipped"
Then it should pass with:
"""
2 features passed, 0 failed, 1 skipped
2 scenarios passed, 0 failed, 2 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-charly.xml" exists
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testsuite name="charly.Charly" tests="1" errors="0" failures="0" skipped="0"
"""
# -- HINT FOR: Python < 3.8
# <testsuite errors="0" failures="0" name="charly.Charly" skipped="0" tests="1"
And the file "test_results/TESTS-charly.xml" should not contain:
"""
<testcase classname="charly.Charly" name="Charly2"
"""
And note that "Charly2 is the skipped scenarion in charly.feature"
@not.with_python.version=3.8
Scenario: Junit report for skipped scenario is shown and counted with --show-skipped
When I run "behave --junit -t @tag1 --show-skipped"
Then it should pass with:
"""
2 features passed, 0 failed, 1 skipped
2 scenarios passed, 0 failed, 2 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-charly.xml" exists
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testsuite errors="0" failures="0" name="charly.Charly" skipped="1" tests="2"
"""
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testcase classname="charly.Charly" name="Charly2" status="skipped"
"""
And note that "Charly2 is the skipped scenarion in charly.feature"
@use.with_python.version=3.8
Scenario: Junit report for skipped scenario is shown and counted with --show-skipped
When I run "behave --junit -t @tag1 --show-skipped"
Then it should pass with:
"""
2 features passed, 0 failed, 1 skipped
2 scenarios passed, 0 failed, 2 skipped
"""
And a file named "test_results/TESTS-alice.xml" exists
And a file named "test_results/TESTS-charly.xml" exists
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testsuite name="charly.Charly" tests="2" errors="0" failures="0" skipped="1"
"""
# HINT: Python < 3.8
# <testsuite errors="0" failures="0" name="charly.Charly" skipped="1" tests="2"
And the file "test_results/TESTS-charly.xml" should contain:
"""
<testcase classname="charly.Charly" name="Charly2" status="skipped"
"""
And note that "Charly2 is the skipped scenarion in charly.feature"
|