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
|
@issue
@already_fixed
Feature: Issue #148: Substeps do not fail
FIXED-BY: issue #117 context.execute_steps() should support table and multi-line text.
RELATED-TO: issue #96
@setup
Scenario: Setup
Given a new working directory
And a file named "features/steps/passing_steps.py" with:
"""
@step('a step passes')
def step_passes(context):
pass
@step('a step fails')
def step_fails(context):
assert False, "XFAIL"
"""
And a file named "features/issue0148_example.feature" with:
"""
Feature: Sub steps
@xfail
Scenario: Failing test without substeps
Given a step passes
When a step fails
Then a step passes
@xfail
Scenario: Failing test with substeps
Given a step passes
When I do something with stupid substeps
Then a step passes
"""
Scenario: Missing Step Keywords in Substeps
Given a file named "features/steps/substeps.py" with:
"""
@When('I do something with stupid substeps')
def step(context):
context.execute_steps(u'''
I do something stupid
there is a second stupid step
''') # Given/When/Then keywords are missing in substeps above.
"""
When I run "behave -f plain -T features/issue0148_example.feature"
Then it should fail with:
"""
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 2 failed, 0 skipped
2 steps passed, 2 failed, 2 skipped, 0 undefined
"""
And the command output should contain:
"""
Scenario: Failing test without substeps
Given a step passes ... passed
When a step fails ... failed
"""
And the command output should contain:
"""
Scenario: Failing test with substeps
Given a step passes ... passed
When I do something with stupid substeps ... failed
"""
And the command output should contain:
"""
ParserError: Failed to parse <string>:
Parser failure in state steps, at line 2: "I do something stupid"
"""
Scenario: Use Step Keywords in Substeps
Given a file named "features/steps/substeps.py" with:
"""
@when('I do something with stupid substeps')
def step(context):
context.execute_steps(u'''
When a step fails
Then a step fails
''')
"""
When I run "behave -f plain -T features/issue0148_example.feature"
Then it should fail with:
"""
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 2 failed, 0 skipped
2 steps passed, 2 failed, 2 skipped, 0 undefined
"""
And the command output should contain:
"""
Scenario: Failing test with substeps
Given a step passes ... passed
When I do something with stupid substeps ... failed
Assertion Failed: FAILED SUB-STEP: When a step fails
Substep info: Assertion Failed: XFAIL
"""
But the command output should not contain:
"""
ParserError: Failed to parse <string>
"""
|