Debian Codegraph @

issue.features/issue0148.feature

raw
1 @issue
2 @already_fixed
3 Feature: Issue #148: Substeps do not fail
4
5 FIXED-BY: issue #117 context.execute_steps() should support table and multi-line text.
6 RELATED-TO: issue #96
7
8 @setup
9 Scenario: Setup
10 Given a new working directory
11 And a file named "features/steps/passing_steps.py" with:
12 """
13 @step('a step passes')
14 def step_passes(context):
15 pass
16
17 @step('a step fails')
18 def step_fails(context):
19 assert False, "XFAIL"
20 """
21 And a file named "features/issue0148_example.feature" with:
22 """
23 Feature: Sub steps
24
25 @xfail
26 Scenario: Failing test without substeps
27 Given a step passes
28 When a step fails
29 Then a step passes
30
31 @xfail
32 Scenario: Failing test with substeps
33 Given a step passes
34 When I do something with stupid substeps
35 Then a step passes
36 """
37
38 Scenario: Missing Step Keywords in Substeps
39 Given a file named "features/steps/substeps.py" with:
40 """
41 @When('I do something with stupid substeps')
42 def step(context):
43 context.execute_steps(u'''
44 I do something stupid
45 there is a second stupid step
46 ''') # Given/When/Then keywords are missing in substeps above.
47 """
48 When I run "behave -f plain -T features/issue0148_example.feature"
49 Then it should fail with:
50 """
51 0 features passed, 1 failed, 0 skipped
52 0 scenarios passed, 2 failed, 0 skipped
53 2 steps passed, 2 failed, 2 skipped, 0 undefined
54 """
55 And the command output should contain:
56 """
57 Scenario: Failing test without substeps
58 Given a step passes ... passed
59 When a step fails ... failed
60 """
61 And the command output should contain:
62 """
63 Scenario: Failing test with substeps
64 Given a step passes ... passed
65 When I do something with stupid substeps ... failed
66 """
67 And the command output should contain:
68 """
69 ParserError: Failed to parse <string>:
70 Parser failure in state steps, at line 2: "I do something stupid"
71 """
72
73
74 Scenario: Use Step Keywords in Substeps
75 Given a file named "features/steps/substeps.py" with:
76 """
77 @when('I do something with stupid substeps')
78 def step(context):
79 context.execute_steps(u'''
80 When a step fails
81 Then a step fails
82 ''')
83 """
84 When I run "behave -f plain -T features/issue0148_example.feature"
85 Then it should fail with:
86 """
87 0 features passed, 1 failed, 0 skipped
88 0 scenarios passed, 2 failed, 0 skipped
89 2 steps passed, 2 failed, 2 skipped, 0 undefined
90 """
91 And the command output should contain:
92 """
93 Scenario: Failing test with substeps
94 Given a step passes ... passed
95 When I do something with stupid substeps ... failed
96 Assertion Failed: FAILED SUB-STEP: When a step fails
97 Substep info: Assertion Failed: XFAIL
98 """
99 But the command output should not contain:
100 """
101
102 ParserError: Failed to parse <string>
103 """
104
105