| 1 |
@issue |
| 2 |
Feature: Issue #330: Skipped scenarios are included in junit reports when --no-skipped is used |
| 3 |
|
| 4 |
@setup |
| 5 |
Scenario: Feature Setup |
| 6 |
Given a new working directory |
| 7 |
And a file named "features/steps/steps.py" with: |
| 8 |
""" |
| 9 |
from behave import step |
| 10 |
|
| 11 |
@step('{word:w} step passes') |
| 12 |
def step_passes(context, word): |
| 13 |
pass |
| 14 |
""" |
| 15 |
And a file named "features/alice.feature" with: |
| 16 |
""" |
| 17 |
@tag1 |
| 18 |
Feature: Alice |
| 19 |
Scenario: Alice1 |
| 20 |
Given a step passes |
| 21 |
""" |
| 22 |
And a file named "features/bob.feature" with: |
| 23 |
""" |
| 24 |
Feature: Bob |
| 25 |
Scenario: Bob1 |
| 26 |
Given another step passes |
| 27 |
""" |
| 28 |
And a file named "features/charly.feature" with: |
| 29 |
""" |
| 30 |
Feature: Charly |
| 31 |
|
| 32 |
@tag1 |
| 33 |
Scenario: Charly1 |
| 34 |
Given some step passes |
| 35 |
|
| 36 |
Scenario: Charly2 |
| 37 |
When another step passes |
| 38 |
""" |
| 39 |
And a file named "alice_and_bob.featureset" with: |
| 40 |
""" |
| 41 |
features/alice.feature |
| 42 |
features/bob.feature |
| 43 |
""" |
| 44 |
And a file named "behave.ini" with: |
| 45 |
""" |
| 46 |
[behave] |
| 47 |
default_format = plain |
| 48 |
junit_directory = test_results |
| 49 |
|
| 50 |
[behave.userdata] |
| 51 |
behave.reporter.junit.show_timestamp = false |
| 52 |
behave.reporter.junit.show_hostname = false |
| 53 |
""" |
| 54 |
|
| 55 |
Scenario: Junit report for skipped feature is not created with --no-skipped |
| 56 |
When I run "behave --junit -t @tag1 --no-skipped @alice_and_bob.featureset" |
| 57 |
Then it should pass with: |
| 58 |
""" |
| 59 |
1 feature passed, 0 failed, 1 skipped |
| 60 |
""" |
| 61 |
And a file named "test_results/TESTS-alice.xml" exists |
| 62 |
And a file named "test_results/TESTS-bob.xml" does not exist |
| 63 |
And the command output should contain: |
| 64 |
""" |
| 65 |
Feature: Alice |
| 66 |
Scenario: Alice1 |
| 67 |
Given a step passes ... passed |
| 68 |
""" |
| 69 |
But the command output should not contain "Feature: Bob" |
| 70 |
And note that "bob.feature is skipped" |
| 71 |
|
| 72 |
|
| •73 |
@not.with_python.version=3.8 |
| 74 |
Scenario: Junit report for skipped feature is created with --show-skipped |
| 75 |
When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset" |
| 76 |
Then it should pass with: |
| 77 |
""" |
| 78 |
1 feature passed, 0 failed, 1 skipped |
| 79 |
""" |
| 80 |
And a file named "test_results/TESTS-alice.xml" exists |
| 81 |
And a file named "test_results/TESTS-bob.xml" exists |
| 82 |
And the file "test_results/TESTS-bob.xml" should contain: |
| 83 |
""" |
| 84 |
<testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0"> |
| 85 |
""" |
| 86 |
|
| •87 |
@use.with_python.version=3.8 |
| 88 |
Scenario: Junit report for skipped feature is created with --show-skipped |
| 89 |
When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset" |
| 90 |
Then it should pass with: |
| 91 |
""" |
| 92 |
1 feature passed, 0 failed, 1 skipped |
| 93 |
""" |
| 94 |
And a file named "test_results/TESTS-alice.xml" exists |
| 95 |
And a file named "test_results/TESTS-bob.xml" exists |
| 96 |
And the file "test_results/TESTS-bob.xml" should contain: |
| 97 |
""" |
| 98 |
<testsuite name="bob.Bob" tests="1" errors="0" failures="0" skipped="1" time="0.0"> |
| 99 |
""" |
| 100 |
# -- HINT FOR: Python < 3.8 |
| 101 |
# <testsuite errors="0" failures="0" name="bob.Bob" skipped="1" tests="1" time="0.0"> |
| 102 |
|
| 103 |
@not.with_python.version=3.8 |
| 104 |
Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped |
| 105 |
When I run "behave --junit -t @tag1 --no-skipped" |
| 106 |
Then it should pass with: |
| 107 |
""" |
| 108 |
2 features passed, 0 failed, 1 skipped |
| 109 |
2 scenarios passed, 0 failed, 2 skipped |
| 110 |
""" |
| 111 |
And a file named "test_results/TESTS-alice.xml" exists |
| 112 |
And a file named "test_results/TESTS-charly.xml" exists |
| 113 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 114 |
""" |
| 115 |
<testsuite errors="0" failures="0" name="charly.Charly" skipped="0" tests="1" |
| 116 |
""" |
| 117 |
And the file "test_results/TESTS-charly.xml" should not contain: |
| 118 |
""" |
| 119 |
<testcase classname="charly.Charly" name="Charly2" |
| 120 |
""" |
| 121 |
And note that "Charly2 is the skipped scenarion in charly.feature" |
| 122 |
|
| •123 |
@use.with_python.version=3.8 |
| 124 |
Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped |
| 125 |
When I run "behave --junit -t @tag1 --no-skipped" |
| 126 |
Then it should pass with: |
| 127 |
""" |
| 128 |
2 features passed, 0 failed, 1 skipped |
| 129 |
2 scenarios passed, 0 failed, 2 skipped |
| 130 |
""" |
| 131 |
And a file named "test_results/TESTS-alice.xml" exists |
| 132 |
And a file named "test_results/TESTS-charly.xml" exists |
| 133 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 134 |
""" |
| 135 |
<testsuite name="charly.Charly" tests="1" errors="0" failures="0" skipped="0" |
| 136 |
""" |
| 137 |
# -- HINT FOR: Python < 3.8 |
| 138 |
# <testsuite errors="0" failures="0" name="charly.Charly" skipped="0" tests="1" |
| 139 |
And the file "test_results/TESTS-charly.xml" should not contain: |
| 140 |
""" |
| 141 |
<testcase classname="charly.Charly" name="Charly2" |
| 142 |
""" |
| 143 |
And note that "Charly2 is the skipped scenarion in charly.feature" |
| 144 |
|
| 145 |
|
| •146 |
@not.with_python.version=3.8 |
| 147 |
Scenario: Junit report for skipped scenario is shown and counted with --show-skipped |
| 148 |
When I run "behave --junit -t @tag1 --show-skipped" |
| 149 |
Then it should pass with: |
| 150 |
""" |
| 151 |
2 features passed, 0 failed, 1 skipped |
| 152 |
2 scenarios passed, 0 failed, 2 skipped |
| 153 |
""" |
| 154 |
And a file named "test_results/TESTS-alice.xml" exists |
| 155 |
And a file named "test_results/TESTS-charly.xml" exists |
| 156 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 157 |
""" |
| 158 |
<testsuite errors="0" failures="0" name="charly.Charly" skipped="1" tests="2" |
| 159 |
""" |
| 160 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 161 |
""" |
| 162 |
<testcase classname="charly.Charly" name="Charly2" status="skipped" |
| 163 |
""" |
| 164 |
And note that "Charly2 is the skipped scenarion in charly.feature" |
| 165 |
|
| •166 |
|
| 167 |
@use.with_python.version=3.8 |
| 168 |
Scenario: Junit report for skipped scenario is shown and counted with --show-skipped |
| 169 |
When I run "behave --junit -t @tag1 --show-skipped" |
| 170 |
Then it should pass with: |
| 171 |
""" |
| 172 |
2 features passed, 0 failed, 1 skipped |
| 173 |
2 scenarios passed, 0 failed, 2 skipped |
| 174 |
""" |
| 175 |
And a file named "test_results/TESTS-alice.xml" exists |
| 176 |
And a file named "test_results/TESTS-charly.xml" exists |
| 177 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 178 |
""" |
| 179 |
<testsuite name="charly.Charly" tests="2" errors="0" failures="0" skipped="1" |
| 180 |
""" |
| 181 |
# HINT: Python < 3.8 |
| 182 |
# <testsuite errors="0" failures="0" name="charly.Charly" skipped="1" tests="2" |
| 183 |
And the file "test_results/TESTS-charly.xml" should contain: |
| 184 |
""" |
| 185 |
<testcase classname="charly.Charly" name="Charly2" status="skipped" |
| 186 |
""" |
| 187 |
And note that "Charly2 is the skipped scenarion in charly.feature" |
| 188 |
|