Debian Codegraph @

issue.features/issue0041.feature

raw
1 @issue
2 Feature: Issue #41 Missing Steps are duplicated in a Scenario Outline
3
4 As I user
5 I want that missing steps are reported only once.
6
7 Background: Test Setup
8 Given a new working directory
9 And a file named "features/steps/steps.py" with:
10 """
11 from behave import given, when, then
12
13 @given(u'I enter a "{name}"')
14 def step(context, name):
15 context.name = name
16
17 @when(u'I enter a "{name}"')
18 def step(context, name):
19 context.name = name
20
21 @then(u'the name is "{name}"')
22 def step(context, name):
23 assert context.name == name
24 """
25
26 Scenario: Missing Given Step
27 Given a file named "features/issue41_missing1.feature" with:
28 """
29 Feature: Missing Given-Step in a Scenario Outline
30 Scenario Outline:
31 Given an unknown step
32 When I enter a "<name>"
33 Then the name is "<name>"
34
35 Examples:
36 |name |
37 |Alice|
38 |Bob |
39 """
40 When I run "behave -c -f plain features/issue41_missing1.feature"
41 Then it should fail with:
42 """
43 0 steps passed, 0 failed, 4 skipped, 2 undefined
44 """
45 And the command output should contain:
46 """
47 You can implement step definitions for undefined steps with these snippets:
48 @given(u'an unknown step')
49 def step_impl(context):
50 raise NotImplementedError(u'STEP: Given an unknown step')
51 """
52 But the command output should not contain:
53 """
54 You can implement step definitions for undefined steps with these snippets:
55 @given(u'an unknown step')
56 def step_impl(context):
57 raise NotImplementedError(u'STEP: Given an unknown step')
58 @given(u'an unknown step')
59 def step_impl(context):
60 raise NotImplementedError(u'STEP: Given an unknown step')
61 """
62
63 Scenario: Missing When Step
64 Given a file named "features/issue41_missing2.feature" with:
65 """
66 Feature: Missing When-Step in a Scenario Outline
67 Scenario Outline:
68 Given I enter a "<name>"
69 When I use an unknown step
70 Then the name is "<name>"
71
72 Examples:
73 |name |
74 |Alice|
75 |Bob |
76 """
77 When I run "behave -c -f plain features/issue41_missing2.feature"
78 Then it should fail with:
79 """
80 2 steps passed, 0 failed, 2 skipped, 2 undefined
81 """
82 And the command output should contain:
83 """
84 You can implement step definitions for undefined steps with these snippets:
85 @when(u'I use an unknown step')
86 def step_impl(context):
87 raise NotImplementedError(u'STEP: When I use an unknown step')
88 """
89 But the command output should not contain:
90 """
91 You can implement step definitions for undefined steps with these snippets:
92 @when(u'I use an unknown step')
93 def step_impl(context):
94 raise NotImplementedError(u'STEP: When I use an unknown step')
95 @when(u'I use an unknown step')
96 def step_impl(context):
97 raise NotImplementedError(u'STEP: When I use an unknown step')
98 """
99
100 Scenario: Missing Then Step
101 Given a file named "features/issue41_missing3.feature" with:
102 """
103 Feature: Missing Then-Step in a Scenario Outline
104 Scenario Outline:
105 Given I enter a "<name>"
106 When I enter a "<name>"
107 Then I use an unknown step
108
109 Examples:
110 |name |
111 |Alice|
112 |Bob |
113 """
114 When I run "behave -c -f plain features/issue41_missing3.feature"
115 Then it should fail with:
116 """
117 4 steps passed, 0 failed, 0 skipped, 2 undefined
118 """
119 And the command output should contain:
120 """
121 You can implement step definitions for undefined steps with these snippets:
122 @then(u'I use an unknown step')
123 def step_impl(context):
124 raise NotImplementedError(u'STEP: Then I use an unknown step')
125 """
126 But the command output should not contain:
127 """
128 You can implement step definitions for undefined steps with these snippets:
129 @then(u'I use an unknown step')
130 def step_impl(context):
131 raise NotImplementedError(u'STEP: Then I use an unknown step')
132 @then(u'I use an unknown step')
133 def step_impl(context):
134 raise NotImplementedError(u'STEP: Then I use an unknown step')
135 """