cucumber 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +1 -1
- data/Caliper.yml +4 -0
- data/History.txt +1557 -0
- data/LICENSE +1 -1
- data/README.rdoc +26 -0
- data/Rakefile +51 -5
- data/VERSION.yml +5 -0
- data/bin/cucumber +1 -7
- data/cucumber.gemspec +77 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
- data/examples/i18n/ro/features/suma.feature +11 -0
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +5 -2
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/announce.feature +164 -0
- data/features/around_hooks.feature +232 -0
- data/features/background.feature +95 -284
- data/features/bug_371.feature +32 -0
- data/features/bug_464.feature +16 -0
- data/features/bug_475.feature +42 -0
- data/features/bug_585_tab_indentation.feature +22 -0
- data/features/bug_600.feature +67 -0
- data/features/call_steps_from_stepdefs.feature +154 -0
- data/features/cucumber_cli.feature +591 -0
- data/features/cucumber_cli_outlines.feature +117 -0
- data/features/custom_formatter.feature +73 -3
- data/features/default_snippets.feature +42 -0
- data/features/diffing.feature +25 -0
- data/features/drb_server_integration.feature +174 -0
- data/features/exception_in_after_block.feature +127 -0
- data/features/exception_in_after_step_block.feature +104 -0
- data/features/exception_in_before_block.feature +98 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +60 -0
- data/features/html_formatter.feature +8 -0
- data/features/html_formatter/a.html +582 -0
- data/features/json_formatter.feature +245 -160
- data/features/junit_formatter.feature +88 -0
- data/features/language_from_header.feature +30 -0
- data/features/language_help.feature +78 -0
- data/features/listener_debugger_formatter.feature +42 -0
- data/features/multiline_names.feature +44 -0
- data/features/negative_tagged_hooks.feature +60 -0
- data/features/post_configuration_hook.feature +37 -0
- data/features/profiles.feature +126 -0
- data/features/rake_task.feature +152 -0
- data/features/report_called_undefined_steps.feature +34 -0
- data/features/rerun_formatter.feature +45 -0
- data/features/simplest.feature +11 -0
- data/features/snippet.feature +23 -0
- data/features/snippets_when_using_star_keyword.feature +36 -0
- data/features/step_definitions/cucumber_steps.rb +153 -7
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/step_definitions/simplest_steps.rb +3 -0
- data/features/step_definitions/wire_steps.rb +32 -0
- data/features/support/env.rb +140 -18
- data/features/support/env.rb.simplest +7 -0
- data/features/support/fake_wire_server.rb +77 -0
- data/features/table_diffing.feature +45 -0
- data/features/table_mapping.feature +34 -0
- data/features/tag_logic.feature +258 -0
- data/features/transform.feature +245 -0
- data/features/unicode_table.feature +35 -0
- data/features/usage_and_stepdefs_formatter.feature +169 -0
- data/features/wire_protocol.feature +332 -0
- data/features/wire_protocol_table_diffing.feature +119 -0
- data/features/wire_protocol_tags.feature +87 -0
- data/features/wire_protocol_timeouts.feature +63 -0
- data/features/work_in_progress.feature +156 -0
- data/fixtures/json/features/pystring.feature +8 -0
- data/fixtures/junit/features/pending.feature +1 -3
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/fixtures/self_test/features/background/background_with_name.feature +7 -0
- data/fixtures/self_test/features/background/failing_background.feature +12 -0
- data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
- data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
- data/fixtures/self_test/features/background/passing_background.feature +10 -0
- data/fixtures/self_test/features/background/pending_background.feature +10 -0
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/fixtures/self_test/features/support/env.rb +0 -8
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/gem_tasks/features.rake +14 -0
- data/gem_tasks/sdoc.rake +12 -0
- data/lib/cucumber.rb +0 -12
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +5 -21
- data/lib/cucumber/ast/examples.rb +4 -12
- data/lib/cucumber/ast/feature.rb +5 -13
- data/lib/cucumber/ast/feature_element.rb +4 -9
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/py_string.rb +80 -0
- data/lib/cucumber/ast/scenario.rb +5 -7
- data/lib/cucumber/ast/scenario_outline.rb +15 -23
- data/lib/cucumber/ast/step.rb +0 -5
- data/lib/cucumber/ast/step_invocation.rb +15 -21
- data/lib/cucumber/ast/table.rb +8 -14
- data/lib/cucumber/ast/tree_walker.rb +48 -10
- data/lib/cucumber/cli/configuration.rb +8 -33
- data/lib/cucumber/cli/main.rb +35 -20
- data/lib/cucumber/cli/options.rb +7 -8
- data/lib/cucumber/cli/profile_loader.rb +0 -2
- data/lib/cucumber/core_ext/proc.rb +1 -2
- data/lib/cucumber/feature_file.rb +15 -47
- data/lib/cucumber/formatter/ansicolor.rb +5 -3
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +23 -27
- data/lib/cucumber/formatter/cucumber.css +17 -34
- data/lib/cucumber/formatter/cucumber.sass +182 -173
- data/lib/cucumber/formatter/html.rb +11 -46
- data/lib/cucumber/formatter/io.rb +4 -2
- data/lib/cucumber/formatter/json.rb +152 -15
- data/lib/cucumber/formatter/json_pretty.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +22 -28
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +11 -22
- data/lib/cucumber/formatter/tag_cloud.rb +35 -0
- data/lib/cucumber/formatter/unicode.rb +20 -41
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +5 -9
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +30 -35
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +31 -74
- data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
- data/lib/cucumber/rb_support/rb_language.rb +8 -10
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
- data/lib/cucumber/rb_support/rb_transform.rb +0 -17
- data/lib/cucumber/rb_support/rb_world.rb +18 -26
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +2 -6
- data/lib/cucumber/step_mother.rb +427 -6
- data/lib/cucumber/wire_support/configuration.rb +1 -4
- data/lib/cucumber/wire_support/wire_language.rb +10 -3
- data/spec/cucumber/ast/background_spec.rb +6 -68
- data/spec/cucumber/ast/feature_factory.rb +4 -5
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +2 -38
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +6 -32
- data/spec/cucumber/cli/drb_client_spec.rb +3 -2
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +1 -28
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/color_io_spec.rb +29 -0
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +5 -3
- data/spec/cucumber/formatter/junit_spec.rb +2 -16
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +12 -11
- data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +9 -11
- data/spec/cucumber/step_mother_spec.rb +302 -0
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +20 -13
- metadata +78 -4
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Feature: Around hooks
|
|
2
|
+
In order to support transactional scenarios for database libraries
|
|
3
|
+
that provide only a block syntax for transactions, Cucumber should
|
|
4
|
+
permit definition of Around hooks.
|
|
5
|
+
|
|
6
|
+
Scenario: A single Around hook
|
|
7
|
+
Given a standard Cucumber project directory structure
|
|
8
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
9
|
+
"""
|
|
10
|
+
Then /^the hook is called$/ do
|
|
11
|
+
$hook_called.should == true
|
|
12
|
+
end
|
|
13
|
+
"""
|
|
14
|
+
And a file named "features/support/hooks.rb" with:
|
|
15
|
+
"""
|
|
16
|
+
Around do |scenario, block|
|
|
17
|
+
$hook_called = true
|
|
18
|
+
block.call
|
|
19
|
+
end
|
|
20
|
+
"""
|
|
21
|
+
And a file named "features/f.feature" with:
|
|
22
|
+
"""
|
|
23
|
+
Feature: Around hooks
|
|
24
|
+
Scenario: using hook
|
|
25
|
+
Then the hook is called
|
|
26
|
+
"""
|
|
27
|
+
When I run cucumber features/f.feature
|
|
28
|
+
Then it should pass with
|
|
29
|
+
"""
|
|
30
|
+
Feature: Around hooks
|
|
31
|
+
|
|
32
|
+
Scenario: using hook # features/f.feature:2
|
|
33
|
+
Then the hook is called # features/step_definitions/steps.rb:1
|
|
34
|
+
|
|
35
|
+
1 scenario (1 passed)
|
|
36
|
+
1 step (1 passed)
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
Scenario: Multiple Around hooks
|
|
41
|
+
Given a standard Cucumber project directory structure
|
|
42
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
43
|
+
"""
|
|
44
|
+
Then /^the hooks are called in the correct order$/ do
|
|
45
|
+
$hooks_called.should == ['A', 'B', 'C']
|
|
46
|
+
end
|
|
47
|
+
"""
|
|
48
|
+
And a file named "features/support/hooks.rb" with:
|
|
49
|
+
"""
|
|
50
|
+
Around do |scenario, block|
|
|
51
|
+
$hooks_called ||= []
|
|
52
|
+
$hooks_called << 'A'
|
|
53
|
+
block.call
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
Around do |scenario, block|
|
|
57
|
+
$hooks_called ||= []
|
|
58
|
+
$hooks_called << 'B'
|
|
59
|
+
block.call
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
Around do |scenario, block|
|
|
63
|
+
$hooks_called ||= []
|
|
64
|
+
$hooks_called << 'C'
|
|
65
|
+
block.call
|
|
66
|
+
end
|
|
67
|
+
"""
|
|
68
|
+
And a file named "features/f.feature" with:
|
|
69
|
+
"""
|
|
70
|
+
Feature: Around hooks
|
|
71
|
+
Scenario: using multiple hooks
|
|
72
|
+
Then the hooks are called in the correct order
|
|
73
|
+
"""
|
|
74
|
+
When I run cucumber features/f.feature
|
|
75
|
+
Then it should pass with
|
|
76
|
+
"""
|
|
77
|
+
Feature: Around hooks
|
|
78
|
+
|
|
79
|
+
Scenario: using multiple hooks # features/f.feature:2
|
|
80
|
+
Then the hooks are called in the correct order # features/step_definitions/steps.rb:1
|
|
81
|
+
|
|
82
|
+
1 scenario (1 passed)
|
|
83
|
+
1 step (1 passed)
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
Scenario: Mixing Around, Before, and After hooks
|
|
88
|
+
Given a standard Cucumber project directory structure
|
|
89
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
90
|
+
"""
|
|
91
|
+
Then /^the Around hook is called around Before and After hooks$/ do
|
|
92
|
+
$hooks_called.should == ['Around', 'Before']
|
|
93
|
+
end
|
|
94
|
+
"""
|
|
95
|
+
And a file named "features/support/hooks.rb" with:
|
|
96
|
+
"""
|
|
97
|
+
Around do |scenario, block|
|
|
98
|
+
$hooks_called ||= []
|
|
99
|
+
$hooks_called << 'Around'
|
|
100
|
+
block.call
|
|
101
|
+
$hooks_called << 'Around'
|
|
102
|
+
$hooks_called.should == ['Around', 'Before', 'After', 'Around']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
Before do |scenario|
|
|
106
|
+
$hooks_called ||= []
|
|
107
|
+
$hooks_called << 'Before'
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
After do |scenario|
|
|
111
|
+
$hooks_called ||= []
|
|
112
|
+
$hooks_called << 'After'
|
|
113
|
+
$hooks_called.should == ['Around', 'Before', 'After']
|
|
114
|
+
end
|
|
115
|
+
"""
|
|
116
|
+
And a file named "features/f.feature" with:
|
|
117
|
+
"""
|
|
118
|
+
Feature: Around hooks
|
|
119
|
+
Scenario: Mixing Around, Before, and After hooks
|
|
120
|
+
Then the Around hook is called around Before and After hooks
|
|
121
|
+
"""
|
|
122
|
+
When I run cucumber features/f.feature
|
|
123
|
+
Then it should pass with
|
|
124
|
+
"""
|
|
125
|
+
Feature: Around hooks
|
|
126
|
+
|
|
127
|
+
Scenario: Mixing Around, Before, and After hooks # features/f.feature:2
|
|
128
|
+
Then the Around hook is called around Before and After hooks # features/step_definitions/steps.rb:1
|
|
129
|
+
|
|
130
|
+
1 scenario (1 passed)
|
|
131
|
+
1 step (1 passed)
|
|
132
|
+
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
Scenario: Around hooks with tags
|
|
136
|
+
Given a standard Cucumber project directory structure
|
|
137
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
138
|
+
"""
|
|
139
|
+
Then /^the Around hooks with matching tags are called$/ do
|
|
140
|
+
$hooks_called.should == ['one', 'one or two']
|
|
141
|
+
end
|
|
142
|
+
"""
|
|
143
|
+
And a file named "features/support/hooks.rb" with:
|
|
144
|
+
"""
|
|
145
|
+
Around('@one') do |scenario, block|
|
|
146
|
+
$hooks_called ||= []
|
|
147
|
+
$hooks_called << 'one'
|
|
148
|
+
block.call
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
Around('@one,@two') do |scenario, block|
|
|
152
|
+
$hooks_called ||= []
|
|
153
|
+
$hooks_called << 'one or two'
|
|
154
|
+
block.call
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
Around('@one', '@two') do |scenario, block|
|
|
158
|
+
$hooks_called ||= []
|
|
159
|
+
$hooks_called << 'one and two'
|
|
160
|
+
block.call
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
Around('@two') do |scenario, block|
|
|
164
|
+
$hooks_called ||= []
|
|
165
|
+
$hooks_called << 'two'
|
|
166
|
+
block.call
|
|
167
|
+
end
|
|
168
|
+
"""
|
|
169
|
+
And a file named "features/f.feature" with:
|
|
170
|
+
"""
|
|
171
|
+
Feature: Around hooks
|
|
172
|
+
@one
|
|
173
|
+
Scenario: Around hooks with tags
|
|
174
|
+
Then the Around hooks with matching tags are called
|
|
175
|
+
"""
|
|
176
|
+
When I run cucumber -q -t @one features/f.feature
|
|
177
|
+
Then it should pass with
|
|
178
|
+
"""
|
|
179
|
+
Feature: Around hooks
|
|
180
|
+
|
|
181
|
+
@one
|
|
182
|
+
Scenario: Around hooks with tags
|
|
183
|
+
Then the Around hooks with matching tags are called
|
|
184
|
+
|
|
185
|
+
1 scenario (1 passed)
|
|
186
|
+
1 step (1 passed)
|
|
187
|
+
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
Scenario: Around hooks with scenario outlines
|
|
191
|
+
Given a standard Cucumber project directory structure
|
|
192
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
193
|
+
"""
|
|
194
|
+
Then /^the hook is called$/ do
|
|
195
|
+
$hook_called.should == true
|
|
196
|
+
end
|
|
197
|
+
"""
|
|
198
|
+
And a file named "features/support/hooks.rb" with:
|
|
199
|
+
"""
|
|
200
|
+
Around do |scenario, block|
|
|
201
|
+
$hook_called = true
|
|
202
|
+
block.call
|
|
203
|
+
end
|
|
204
|
+
"""
|
|
205
|
+
And a file named "features/f.feature" with:
|
|
206
|
+
"""
|
|
207
|
+
Feature: Around hooks with scenario outlines
|
|
208
|
+
Scenario Outline: using hook
|
|
209
|
+
Then the hook is called
|
|
210
|
+
|
|
211
|
+
Examples:
|
|
212
|
+
| Number |
|
|
213
|
+
| one |
|
|
214
|
+
| two |
|
|
215
|
+
"""
|
|
216
|
+
When I run cucumber features/f.feature
|
|
217
|
+
Then it should pass with
|
|
218
|
+
"""
|
|
219
|
+
Feature: Around hooks with scenario outlines
|
|
220
|
+
|
|
221
|
+
Scenario Outline: using hook # features/f.feature:2
|
|
222
|
+
Then the hook is called # features/step_definitions/steps.rb:1
|
|
223
|
+
|
|
224
|
+
Examples:
|
|
225
|
+
| Number |
|
|
226
|
+
| one |
|
|
227
|
+
| two |
|
|
228
|
+
|
|
229
|
+
2 scenarios (2 passed)
|
|
230
|
+
2 steps (2 passed)
|
|
231
|
+
|
|
232
|
+
"""
|
data/features/background.feature
CHANGED
|
@@ -1,195 +1,12 @@
|
|
|
1
|
-
Feature:
|
|
1
|
+
Feature: backgrounds
|
|
2
2
|
In order to provide a context to my scenarios within a feature
|
|
3
3
|
As a feature editor
|
|
4
4
|
I want to write a background section in my features.
|
|
5
5
|
|
|
6
|
-
Background:
|
|
7
|
-
Given a file named "features/passing_background.feature" with:
|
|
8
|
-
"""
|
|
9
|
-
Feature: Passing background sample
|
|
10
|
-
|
|
11
|
-
Background:
|
|
12
|
-
Given '10' cukes
|
|
13
|
-
|
|
14
|
-
Scenario: passing background
|
|
15
|
-
Then I should have '10' cukes
|
|
16
|
-
|
|
17
|
-
Scenario: another passing background
|
|
18
|
-
Then I should have '10' cukes
|
|
19
|
-
"""
|
|
20
|
-
And a file named "features/scenario_outline_passing_background.feature" with:
|
|
21
|
-
"""
|
|
22
|
-
Feature: Passing background with scenario outlines sample
|
|
23
|
-
|
|
24
|
-
Background:
|
|
25
|
-
Given '10' cukes
|
|
26
|
-
|
|
27
|
-
Scenario Outline: passing background
|
|
28
|
-
Then I should have '<count>' cukes
|
|
29
|
-
Examples:
|
|
30
|
-
|count|
|
|
31
|
-
| 10 |
|
|
32
|
-
|
|
33
|
-
Scenario Outline: another passing background
|
|
34
|
-
Then I should have '<count>' cukes
|
|
35
|
-
Examples:
|
|
36
|
-
|count|
|
|
37
|
-
| 10 |
|
|
38
|
-
"""
|
|
39
|
-
And a file named "features/background_tagged_before_on_outline.feature" with:
|
|
40
|
-
"""
|
|
41
|
-
@background_tagged_before_on_outline
|
|
42
|
-
Feature: Background tagged Before on Outline
|
|
43
|
-
|
|
44
|
-
Background:
|
|
45
|
-
Given passing without a table
|
|
46
|
-
|
|
47
|
-
Scenario Outline: passing background
|
|
48
|
-
Then I should have '<count>' cukes
|
|
49
|
-
|
|
50
|
-
Examples:
|
|
51
|
-
| count |
|
|
52
|
-
| 888 |
|
|
53
|
-
"""
|
|
54
|
-
And a file named "features/failing_background.feature" with:
|
|
55
|
-
"""
|
|
56
|
-
Feature: Failing background sample
|
|
57
|
-
|
|
58
|
-
Background:
|
|
59
|
-
Given failing without a table
|
|
60
|
-
And '10' cukes
|
|
61
|
-
|
|
62
|
-
Scenario: failing background
|
|
63
|
-
Then I should have '10' cukes
|
|
64
|
-
|
|
65
|
-
Scenario: another failing background
|
|
66
|
-
Then I should have '10' cukes
|
|
67
|
-
"""
|
|
68
|
-
And a file named "features/scenario_outline_failing_background.feature" with:
|
|
69
|
-
"""
|
|
70
|
-
Feature: Failing background with scenario outlines sample
|
|
71
|
-
|
|
72
|
-
Background:
|
|
73
|
-
Given failing without a table
|
|
74
|
-
|
|
75
|
-
Scenario Outline: failing background
|
|
76
|
-
Then I should have '<count>' cukes
|
|
77
|
-
Examples:
|
|
78
|
-
|count|
|
|
79
|
-
| 10 |
|
|
80
|
-
|
|
81
|
-
Scenario Outline: another failing background
|
|
82
|
-
Then I should have '<count>' cukes
|
|
83
|
-
Examples:
|
|
84
|
-
|count|
|
|
85
|
-
| 10 |
|
|
86
|
-
"""
|
|
87
|
-
And a file named "features/pending_background.feature" with:
|
|
88
|
-
"""
|
|
89
|
-
Feature: Pending background sample
|
|
90
|
-
|
|
91
|
-
Background:
|
|
92
|
-
Given pending
|
|
93
|
-
|
|
94
|
-
Scenario: pending background
|
|
95
|
-
Then I should have '10' cukes
|
|
96
|
-
|
|
97
|
-
Scenario: another pending background
|
|
98
|
-
Then I should have '10' cukes
|
|
99
|
-
"""
|
|
100
|
-
And a file named "features/failing_background_after_success.feature" with:
|
|
101
|
-
"""
|
|
102
|
-
Feature: Failing background after previously successful background sample
|
|
103
|
-
|
|
104
|
-
Background:
|
|
105
|
-
Given passing without a table
|
|
106
|
-
And '10' global cukes
|
|
107
|
-
|
|
108
|
-
Scenario: passing background
|
|
109
|
-
Then I should have '10' global cukes
|
|
110
|
-
|
|
111
|
-
Scenario: failing background
|
|
112
|
-
Then I should have '10' global cukes
|
|
113
|
-
"""
|
|
114
|
-
And a file named "features/multiline_args_background.feature" with:
|
|
115
|
-
"""
|
|
116
|
-
Feature: Passing background with multiline args
|
|
117
|
-
|
|
118
|
-
Background:
|
|
119
|
-
Given table
|
|
120
|
-
|a|b|
|
|
121
|
-
|c|d|
|
|
122
|
-
And multiline string
|
|
123
|
-
\"\"\"
|
|
124
|
-
I'm a cucumber and I'm okay.
|
|
125
|
-
I sleep all night and I test all day
|
|
126
|
-
\"\"\"
|
|
127
|
-
|
|
128
|
-
Scenario: passing background
|
|
129
|
-
Then the table should be
|
|
130
|
-
|a|b|
|
|
131
|
-
|c|d|
|
|
132
|
-
Then the multiline string should be
|
|
133
|
-
\"\"\"
|
|
134
|
-
I'm a cucumber and I'm okay.
|
|
135
|
-
I sleep all night and I test all day
|
|
136
|
-
\"\"\"
|
|
137
|
-
|
|
138
|
-
Scenario: another passing background
|
|
139
|
-
Then the table should be
|
|
140
|
-
|a|b|
|
|
141
|
-
|c|d|
|
|
142
|
-
Then the multiline string should be
|
|
143
|
-
\"\"\"
|
|
144
|
-
I'm a cucumber and I'm okay.
|
|
145
|
-
I sleep all night and I test all day
|
|
146
|
-
\"\"\"
|
|
147
|
-
"""
|
|
148
|
-
And a file named "features/step_definitions/steps.rb" with:
|
|
149
|
-
"""
|
|
150
|
-
def flunker
|
|
151
|
-
raise "FAIL"
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
Given /^'(.+)' cukes$/ do |cukes| x=1
|
|
155
|
-
raise "We already have #{@cukes} cukes!" if @cukes
|
|
156
|
-
@cukes = cukes
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
Given(/^passing without a table$/) do
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
Given /^failing without a table$/ do x=1
|
|
163
|
-
flunker
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
Given /^'(.+)' global cukes$/ do |cukes| x=1
|
|
167
|
-
$scenario_runs ||= 0
|
|
168
|
-
flunker if $scenario_runs >= 1
|
|
169
|
-
$cukes = cukes
|
|
170
|
-
$scenario_runs += 1
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
Then /^I should have '(.+)' global cukes$/ do |cukes| x=1
|
|
174
|
-
$cukes.should == cukes
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
Then /^I should have '(.+)' cukes$/ do |cukes| x=1
|
|
178
|
-
@cukes.should == cukes
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
Before('@background_tagged_before_on_outline') do
|
|
182
|
-
@cukes = '888'
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
After('@background_tagged_before_on_outline') do
|
|
186
|
-
@cukes.should == '888'
|
|
187
|
-
end
|
|
188
|
-
"""
|
|
189
|
-
|
|
190
6
|
Scenario: run a specific scenario with a background
|
|
191
|
-
When I run
|
|
192
|
-
Then
|
|
7
|
+
When I run cucumber -q features/background/passing_background.feature:9 --require features
|
|
8
|
+
Then STDERR should be empty
|
|
9
|
+
Then it should pass with
|
|
193
10
|
"""
|
|
194
11
|
Feature: Passing background sample
|
|
195
12
|
|
|
@@ -201,13 +18,12 @@ Feature: Background
|
|
|
201
18
|
|
|
202
19
|
1 scenario (1 passed)
|
|
203
20
|
2 steps (2 passed)
|
|
204
|
-
|
|
205
|
-
|
|
21
|
+
|
|
206
22
|
"""
|
|
207
23
|
|
|
208
24
|
Scenario: run a feature with a background that passes
|
|
209
|
-
When I run
|
|
210
|
-
Then it should pass with
|
|
25
|
+
When I run cucumber -q features/background/passing_background.feature --require features
|
|
26
|
+
Then it should pass with
|
|
211
27
|
"""
|
|
212
28
|
Feature: Passing background sample
|
|
213
29
|
|
|
@@ -222,13 +38,12 @@ Feature: Background
|
|
|
222
38
|
|
|
223
39
|
2 scenarios (2 passed)
|
|
224
40
|
4 steps (4 passed)
|
|
225
|
-
|
|
226
|
-
|
|
41
|
+
|
|
227
42
|
"""
|
|
228
43
|
|
|
229
44
|
Scenario: run a feature with scenario outlines that has a background that passes
|
|
230
|
-
When I run
|
|
231
|
-
Then it should pass with
|
|
45
|
+
When I run cucumber -q features/background/scenario_outline_passing_background.feature --require features
|
|
46
|
+
Then it should pass with
|
|
232
47
|
"""
|
|
233
48
|
Feature: Passing background with scenario outlines sample
|
|
234
49
|
|
|
@@ -251,13 +66,12 @@ Feature: Background
|
|
|
251
66
|
|
|
252
67
|
2 scenarios (2 passed)
|
|
253
68
|
4 steps (4 passed)
|
|
254
|
-
0m0.012s
|
|
255
69
|
|
|
256
70
|
"""
|
|
257
71
|
|
|
258
72
|
Scenario: run a feature with scenario outlines that has a background that passes
|
|
259
|
-
When I run
|
|
260
|
-
Then it should pass with
|
|
73
|
+
When I run cucumber -q features/background/background_tagged_before_on_outline.feature --require features
|
|
74
|
+
Then it should pass with
|
|
261
75
|
"""
|
|
262
76
|
@background_tagged_before_on_outline
|
|
263
77
|
Feature: Background tagged Before on Outline
|
|
@@ -274,22 +88,22 @@ Feature: Background
|
|
|
274
88
|
|
|
275
89
|
1 scenario (1 passed)
|
|
276
90
|
2 steps (2 passed)
|
|
277
|
-
0m0.012s
|
|
278
91
|
|
|
279
92
|
"""
|
|
280
93
|
|
|
281
94
|
Scenario: run a feature with a background that fails
|
|
282
|
-
When I run
|
|
283
|
-
Then it should fail with
|
|
95
|
+
When I run cucumber -q features/background/failing_background.feature --require features
|
|
96
|
+
Then it should fail with
|
|
284
97
|
"""
|
|
98
|
+
@after_file
|
|
285
99
|
Feature: Failing background sample
|
|
286
100
|
|
|
287
101
|
Background:
|
|
288
102
|
Given failing without a table
|
|
289
103
|
FAIL (RuntimeError)
|
|
290
|
-
./features/step_definitions/
|
|
291
|
-
./features/step_definitions/
|
|
292
|
-
features/failing_background.feature:
|
|
104
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
105
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
106
|
+
features/background/failing_background.feature:5:in `Given failing without a table'
|
|
293
107
|
And '10' cukes
|
|
294
108
|
|
|
295
109
|
Scenario: failing background
|
|
@@ -299,26 +113,26 @@ Feature: Background
|
|
|
299
113
|
Then I should have '10' cukes
|
|
300
114
|
|
|
301
115
|
Failing Scenarios:
|
|
302
|
-
cucumber features/failing_background.feature:
|
|
116
|
+
cucumber features/background/failing_background.feature:8 # Scenario: failing background
|
|
303
117
|
|
|
304
118
|
2 scenarios (1 failed, 1 skipped)
|
|
305
119
|
6 steps (1 failed, 5 skipped)
|
|
306
|
-
|
|
307
|
-
|
|
120
|
+
|
|
308
121
|
"""
|
|
122
|
+
And "fixtures/self_test/tmp/after.txt" should exist
|
|
309
123
|
|
|
310
124
|
Scenario: run a feature with scenario outlines that has a background that fails
|
|
311
|
-
When I run
|
|
312
|
-
Then it should fail with
|
|
125
|
+
When I run cucumber -q features/background/scenario_outline_failing_background.feature --require features
|
|
126
|
+
Then it should fail with
|
|
313
127
|
"""
|
|
314
128
|
Feature: Failing background with scenario outlines sample
|
|
315
129
|
|
|
316
130
|
Background:
|
|
317
131
|
Given failing without a table
|
|
318
132
|
FAIL (RuntimeError)
|
|
319
|
-
./features/step_definitions/
|
|
320
|
-
./features/step_definitions/
|
|
321
|
-
features/scenario_outline_failing_background.feature:4:in `Given failing without a table'
|
|
133
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
134
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
135
|
+
features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'
|
|
322
136
|
|
|
323
137
|
Scenario Outline: failing background
|
|
324
138
|
Then I should have '<count>' cukes
|
|
@@ -335,17 +149,16 @@ Feature: Background
|
|
|
335
149
|
| 10 |
|
|
336
150
|
|
|
337
151
|
Failing Scenarios:
|
|
338
|
-
cucumber features/scenario_outline_failing_background.feature:6 # Scenario: failing background
|
|
152
|
+
cucumber features/background/scenario_outline_failing_background.feature:6 # Scenario: failing background
|
|
339
153
|
|
|
340
154
|
2 scenarios (1 failed, 1 skipped)
|
|
341
155
|
4 steps (1 failed, 3 skipped)
|
|
342
|
-
|
|
343
|
-
|
|
156
|
+
|
|
344
157
|
"""
|
|
345
158
|
|
|
346
159
|
Scenario: run a feature with a background that is pending
|
|
347
|
-
When I run
|
|
348
|
-
Then it should pass with
|
|
160
|
+
When I run cucumber -q features/background/pending_background.feature --require features
|
|
161
|
+
Then it should pass with
|
|
349
162
|
"""
|
|
350
163
|
Feature: Pending background sample
|
|
351
164
|
|
|
@@ -360,13 +173,12 @@ Feature: Background
|
|
|
360
173
|
|
|
361
174
|
2 scenarios (2 undefined)
|
|
362
175
|
4 steps (2 skipped, 2 undefined)
|
|
363
|
-
|
|
364
|
-
|
|
176
|
+
|
|
365
177
|
"""
|
|
366
178
|
|
|
367
179
|
Scenario: background passes with first scenario but fails with second
|
|
368
|
-
When I run
|
|
369
|
-
Then it should fail with
|
|
180
|
+
When I run cucumber -q features/background/failing_background_after_success.feature --require features
|
|
181
|
+
Then it should fail with
|
|
370
182
|
"""
|
|
371
183
|
Feature: Failing background after previously successful background sample
|
|
372
184
|
|
|
@@ -380,86 +192,84 @@ Feature: Background
|
|
|
380
192
|
Scenario: failing background
|
|
381
193
|
And '10' global cukes
|
|
382
194
|
FAIL (RuntimeError)
|
|
383
|
-
./features/step_definitions/
|
|
384
|
-
./features/step_definitions/
|
|
385
|
-
features/failing_background_after_success.feature:5:in `And '10' global cukes'
|
|
195
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
196
|
+
./features/step_definitions/sample_steps.rb:37:in `/^'(.+)' global cukes$/'
|
|
197
|
+
features/background/failing_background_after_success.feature:5:in `And '10' global cukes'
|
|
386
198
|
Then I should have '10' global cukes
|
|
387
199
|
|
|
388
200
|
Failing Scenarios:
|
|
389
|
-
cucumber features/failing_background_after_success.feature:10 # Scenario: failing background
|
|
201
|
+
cucumber features/background/failing_background_after_success.feature:10 # Scenario: failing background
|
|
390
202
|
|
|
391
203
|
2 scenarios (1 failed, 1 passed)
|
|
392
204
|
6 steps (1 failed, 1 skipped, 4 passed)
|
|
393
|
-
|
|
394
|
-
|
|
205
|
+
|
|
395
206
|
"""
|
|
396
207
|
|
|
397
208
|
Scenario: background with multline args
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
end
|
|
403
|
-
|
|
404
|
-
Given /^multiline string$/ do |string| x=1
|
|
405
|
-
@multiline = string
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
Then /^the table should be$/ do |table| x=1
|
|
409
|
-
@table.raw.should == table.raw
|
|
410
|
-
end
|
|
209
|
+
When I run cucumber -q features/background/multiline_args_background.feature --require features
|
|
210
|
+
Then it should pass with
|
|
211
|
+
"""
|
|
212
|
+
Feature: Passing background with multiline args
|
|
411
213
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
"""
|
|
419
|
-
Feature: Passing background with multiline args
|
|
420
|
-
|
|
421
|
-
Background:
|
|
422
|
-
Given table
|
|
423
|
-
| a | b |
|
|
424
|
-
| c | d |
|
|
425
|
-
And multiline string
|
|
426
|
-
\"\"\"
|
|
214
|
+
Background:
|
|
215
|
+
Given table
|
|
216
|
+
| a | b |
|
|
217
|
+
| c | d |
|
|
218
|
+
And multiline string
|
|
219
|
+
\"\"\"
|
|
427
220
|
I'm a cucumber and I'm okay.
|
|
428
221
|
I sleep all night and I test all day
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
222
|
+
\"\"\"
|
|
223
|
+
|
|
224
|
+
Scenario: passing background
|
|
225
|
+
Then the table should be
|
|
226
|
+
| a | b |
|
|
227
|
+
| c | d |
|
|
228
|
+
Then the multiline string should be
|
|
229
|
+
\"\"\"
|
|
437
230
|
I'm a cucumber and I'm okay.
|
|
438
231
|
I sleep all night and I test all day
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
232
|
+
\"\"\"
|
|
233
|
+
|
|
234
|
+
Scenario: another passing background
|
|
235
|
+
Then the table should be
|
|
236
|
+
| a | b |
|
|
237
|
+
| c | d |
|
|
238
|
+
Then the multiline string should be
|
|
239
|
+
\"\"\"
|
|
447
240
|
I'm a cucumber and I'm okay.
|
|
448
241
|
I sleep all night and I test all day
|
|
449
|
-
|
|
242
|
+
\"\"\"
|
|
450
243
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
0m0.012s
|
|
244
|
+
2 scenarios (2 passed)
|
|
245
|
+
8 steps (8 passed)
|
|
454
246
|
|
|
455
|
-
|
|
247
|
+
"""
|
|
248
|
+
|
|
249
|
+
Scenario: background with name
|
|
250
|
+
When I run cucumber -q features/background/background_with_name.feature --require features
|
|
251
|
+
Then it should pass with
|
|
252
|
+
"""
|
|
253
|
+
Feature: background with name
|
|
254
|
+
|
|
255
|
+
Background: I'm a background and I'm ok
|
|
256
|
+
Given '10' cukes
|
|
257
|
+
|
|
258
|
+
Scenario: example
|
|
259
|
+
Then I should have '10' cukes
|
|
260
|
+
|
|
261
|
+
1 scenario (1 passed)
|
|
262
|
+
2 steps (2 passed)
|
|
263
|
+
|
|
264
|
+
"""
|
|
456
265
|
|
|
457
266
|
Scenario: https://rspec.lighthouseapp.com/projects/16211/tickets/329
|
|
458
|
-
Given a
|
|
267
|
+
Given a standard Cucumber project directory structure
|
|
268
|
+
And a file named "features/only_background_and_hooks.feature" with:
|
|
459
269
|
"""
|
|
460
270
|
Feature: woo yeah
|
|
461
271
|
|
|
462
|
-
Background:
|
|
272
|
+
Background:
|
|
463
273
|
Given whatever
|
|
464
274
|
|
|
465
275
|
"""
|
|
@@ -483,16 +293,17 @@ Feature: Background
|
|
|
483
293
|
$after.should == true
|
|
484
294
|
end
|
|
485
295
|
"""
|
|
486
|
-
When I run
|
|
487
|
-
Then it should pass
|
|
296
|
+
When I run cucumber features/only_background_and_hooks.feature
|
|
297
|
+
Then it should pass
|
|
298
|
+
And the output should be
|
|
488
299
|
"""
|
|
489
300
|
Feature: woo yeah
|
|
490
301
|
|
|
491
|
-
Background:
|
|
492
|
-
Given whatever
|
|
302
|
+
Background: # features/only_background_and_hooks.feature:3
|
|
303
|
+
Given whatever # features/only_background_and_hooks_steps.rb:11
|
|
493
304
|
|
|
494
305
|
0 scenarios
|
|
495
306
|
1 step (1 passed)
|
|
496
|
-
|
|
497
|
-
|
|
307
|
+
|
|
498
308
|
"""
|
|
309
|
+
And STDERR should be empty
|