Debian Codegraph @

features/step.pending_steps.feature

raw
1 Feature: Pending Step (Exists with NotImplementedError Marker)
2
3 . TERMINOLOGY:
4 . * An undefined step is a step without matching step implementation.
5 . * A pending step exists,
6 . but contains only the undefined step snippet as implementation,
7 . that marks it as NotImplemented.
8 .
9 . RELATED TO:
10 . * step.undefined_steps.feature
11
12
13 @setup
14 Scenario: Feature Setup
15 Given a new working directory
16 And a file named "behave.ini" with:
17 """
18 [behave]
19 show_skipped = false
20 show_timings = false
21 """
22 And a file named "features/steps/passing_steps.py" with:
23 """
24 from behave import step
25
26 @step('{word:w} step passes')
27 def step_passes(context, word):
28 pass
29
30 @step('{word:w} step fails')
31 def step_fails(context, word):
32 assert False, "XFAIL"
33 """
34 And a file named "features/steps/pending_steps.py" with:
35 """
36 from behave import given, when, then
37
38 @given('a pending step is used')
39 def step_pending_given(context):
40 raise NotImplementedError('STEP: Given a pending step is used')
41
42 @when('a pending step is used')
43 def step_pending_when(context):
44 raise NotImplementedError('STEP: When a pending step is used')
45
46 @then('a pending step is used')
47 def step_pending_then(context):
48 raise NotImplementedError('STEP: Then a pending step is used')
49 """
50 And a file named "features/use_pending_steps.feature" with:
51 """
52 Feature:
53 Scenario: 1
54 Given a step passes
55 And a pending step is used
56 When another step passes
57
58 Scenario: 2
59 Given a step passes
60 When a pending step is used
61 Then some step passes
62
63 Scenario: 3
64 Given a step passes
65 When another step passes
66 Then a pending step is used
67 """
68
69 Scenario: Pending given step (not implemented)
70 When I run "behave -f plain features/use_pending_steps.feature:2"
71 Then it should fail
72 And the command output should contain:
73 """
74 Feature:
75 Scenario: 1
76 Given a step passes ... passed
77 And a pending step is used ... failed
78 """
79 But the command output should contain:
80 """
81 NotImplementedError: STEP: Given a pending step is used
82 """
83 And the command output should contain:
84 """
85 File "features/steps/pending_steps.py", line 5, in step_pending_given
86 raise NotImplementedError('STEP: Given a pending step is used')
87 """
88
89 Scenario: Pending when step (not implemented)
90 When I run "behave -f plain features/use_pending_steps.feature:7"
91 Then it should fail
92 And the command output should contain:
93 """
94 Feature:
95 Scenario: 2
96 Given a step passes ... passed
97 When a pending step is used ... failed
98 """
99 But the command output should contain:
100 """
101 NotImplementedError: STEP: When a pending step is used
102 """
103 And the command output should contain:
104 """
105 File "features/steps/pending_steps.py", line 9, in step_pending_when
106 raise NotImplementedError('STEP: When a pending step is used')
107 """
108
109 Scenario: Pending then step (not implemented)
110 When I run "behave -f plain features/use_pending_steps.feature:12"
111 Then it should fail
112 And the command output should contain:
113 """
114 Feature:
115 Scenario: 3
116 Given a step passes ... passed
117 When another step passes ... passed
118 Then a pending step is used ... failed
119 """
120 But the command output should contain:
121 """
122 NotImplementedError: STEP: Then a pending step is used
123 """
124 And the command output should contain:
125 """
126 File "features/steps/pending_steps.py", line 13, in step_pending_then
127 raise NotImplementedError('STEP: Then a pending step is used')
128 """