| 1 |
@issue |
| 2 |
Feature: Issue #69: JUnitReporter: Fault when processing ScenarioOutlines with failing steps |
| 3 |
|
| 4 |
The problem occurs when "behave --junit ..." is used |
| 5 |
And a feature contains one or more ScenarioOutline(s) with failing steps. |
| 6 |
|
| 7 |
The JUnitReport does not process ScenarioOutline correctly (logic-error). |
| 8 |
Therefore, Scenarios of a ScenarioOutline are processes as Scenario steps. |
| 9 |
This causes problems when the step.status is "failed". |
| 10 |
|
| 11 |
RELATED: |
| 12 |
* issue #63 |
| 13 |
|
| 14 |
Background: Test Setup |
| 15 |
Given a new working directory |
| 16 |
And a file named "features/steps/steps.py" with: |
| 17 |
""" |
| 18 |
from behave import given |
| 19 |
|
| 20 |
@given(u'a {outcome} step with "{name}"') |
| 21 |
def step(context, outcome, name): |
| 22 |
context.name = name |
| 23 |
assert outcome == "passing" |
| 24 |
|
| 25 |
@when(u'a {outcome} step with "{name}" occurs') |
| 26 |
def step(context, outcome, name): |
| 27 |
assert outcome == "passing" |
| 28 |
assert context.name == name |
| 29 |
|
| 30 |
@then(u'a {outcome} step with "{name}" is reached') |
| 31 |
def step(context, outcome, name): |
| 32 |
assert outcome == "passing" |
| 33 |
assert context.name == name |
| 34 |
""" |
| 35 |
|
| 36 |
Scenario: ScenarioOutline with Failing Steps |
| 37 |
Given a file named "features/issue63_case2.feature" with: |
| 38 |
""" |
| 39 |
Feature: ScenarioOutline with Passing and Failing Steps |
| 40 |
Scenario Outline: |
| 41 |
Given a passing step with "<name>" |
| 42 |
When a failing step with "<name>" occurs |
| 43 |
Then a passing step with "<name>" is reached |
| 44 |
|
| 45 |
Examples: |
| 46 |
|name | |
| 47 |
|Alice| |
| 48 |
|Bob | |
| 49 |
""" |
| 50 |
When I run "behave -c --junit features/issue63_case2.feature" |
| 51 |
Then it should fail with: |
| 52 |
""" |
| 53 |
0 scenarios passed, 2 failed, 0 skipped |
| 54 |
2 steps passed, 2 failed, 2 skipped, 0 undefined |
| 55 |
""" |
| 56 |
But the command output should not contain: |
| 57 |
""" |
| 58 |
AttributeError: 'Scenario' object has no attribute 'exception' |
| 59 |
""" |
| 60 |
And the command output should not contain: |
| 61 |
""" |
| 62 |
behave/reporter/junit.py |
| 63 |
""" |
| 64 |
|