| 1 |
@issue |
| 2 |
Feature: Issue #125: Duplicate "Captured stdout" if substep has failed |
| 3 |
|
| 4 |
|
| 5 |
Background: Test 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('a step fails with stdout "{message}"') |
| 12 |
def step_fails_with_stdout(context, message): |
| 13 |
print(message) |
| 14 |
assert False, 'EXPECT: Step fails with stdout.' |
| 15 |
|
| 16 |
@step('substep fails with stdout "{message}"') |
| 17 |
def substep_fails_with_stdout(context, message): |
| 18 |
context.execute_steps(u'When a step fails with stdout "%s"' % message) |
| 19 |
""" |
| 20 |
|
| 21 |
Scenario: Subprocess call shows generated output |
| 22 |
Given a file named "features/issue125_example.feature" with: |
| 23 |
""" |
| 24 |
Feature: |
| 25 |
Scenario: |
| 26 |
When substep fails with stdout "Hello" |
| 27 |
""" |
| 28 |
When I run "behave -f plain --no-timings features/issue125_example.feature" |
| 29 |
Then it should fail with: |
| 30 |
""" |
| 31 |
0 scenarios passed, 1 failed, 0 skipped |
| 32 |
0 steps passed, 1 failed, 0 skipped, 0 undefined |
| 33 |
""" |
| 34 |
And the command output should contain: |
| 35 |
""" |
| 36 |
Feature: |
| 37 |
Scenario: |
| 38 |
When substep fails with stdout "Hello" ... failed |
| 39 |
|
| 40 |
Assertion Failed: FAILED SUB-STEP: When a step fails with stdout "Hello" |
| 41 |
Substep info: Assertion Failed: EXPECT: Step fails with stdout. |
| 42 |
""" |
| 43 |
And the command output should contain 1 times: |
| 44 |
""" |
| 45 |
Captured stdout: |
| 46 |
Hello |
| 47 |
""" |
| 48 |
But note that "the captured output should not be contained multiple times" |
| 49 |
|