aslakhellesoy-cucumber 0.1.16.4 → 0.1.16.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/History.txt +75 -1
  2. data/Manifest.txt +58 -65
  3. data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
  4. data/examples/i18n/Rakefile +3 -3
  5. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -6
  6. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
  7. data/examples/i18n/de/features/addition.feature +6 -6
  8. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -2
  9. data/examples/i18n/en/features/addition.feature +6 -6
  10. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -2
  11. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -1
  12. data/examples/i18n/et/features/liitmine.feature +7 -6
  13. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
  14. data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
  15. data/examples/i18n/fi/features/yhteenlasku.feature +2 -2
  16. data/examples/i18n/fr/features/addition.feature +2 -2
  17. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
  18. data/examples/i18n/id/features/addition.feature +6 -6
  19. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -2
  20. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
  21. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -3
  22. data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
  23. data/examples/i18n/lt/features/addition.feature +7 -6
  24. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -2
  25. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +7 -7
  26. data/examples/i18n/no/features/summering.feature +1 -0
  27. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
  28. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
  29. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
  30. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
  31. data/examples/jbehave/README.textile +17 -0
  32. data/examples/jbehave/features/support/env.rb +7 -0
  33. data/examples/jbehave/features/trading.feature +24 -0
  34. data/examples/jbehave/pom.xml +48 -0
  35. data/examples/self_test/README.textile +4 -1
  36. data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
  37. data/examples/self_test/features/lots_of_undefined.feature +8 -0
  38. data/examples/self_test/features/outline_sample.feature +8 -5
  39. data/examples/self_test/features/sample.feature +5 -3
  40. data/examples/self_test/features/step_definitions/sample_steps.rb +15 -3
  41. data/features/cucumber_cli.feature +199 -97
  42. data/features/cucumber_cli_outlines.feature +46 -38
  43. data/features/report_called_undefined_steps.feature +31 -0
  44. data/features/step_definitions/cucumber_steps.rb +7 -3
  45. data/features/step_definitions/extra_steps.rb +1 -1
  46. data/features/support/env.rb +1 -1
  47. data/gem_tasks/features.rake +1 -1
  48. data/gem_tasks/flog.rake +1 -1
  49. data/lib/autotest/cucumber_mixin.rb +16 -23
  50. data/lib/cucumber/ast/comment.rb +26 -0
  51. data/lib/cucumber/ast/examples.rb +22 -0
  52. data/lib/cucumber/ast/feature.rb +60 -0
  53. data/lib/cucumber/ast/features.rb +39 -0
  54. data/lib/cucumber/ast/filter.rb +22 -0
  55. data/lib/cucumber/ast/outline_table.rb +49 -0
  56. data/lib/cucumber/ast/py_string.rb +52 -0
  57. data/lib/cucumber/ast/scenario.rb +91 -0
  58. data/lib/cucumber/ast/scenario_outline.rb +83 -0
  59. data/lib/cucumber/ast/step.rb +130 -0
  60. data/lib/cucumber/ast/table.rb +214 -0
  61. data/lib/cucumber/ast/tags.rb +33 -0
  62. data/lib/cucumber/ast/visitor.rb +93 -0
  63. data/lib/cucumber/ast.rb +27 -0
  64. data/lib/cucumber/broadcaster.rb +1 -6
  65. data/lib/cucumber/cli.rb +178 -128
  66. data/lib/cucumber/core_ext/exception.rb +41 -8
  67. data/lib/cucumber/core_ext/instance_exec.rb +54 -0
  68. data/lib/cucumber/core_ext/proc.rb +29 -65
  69. data/lib/cucumber/core_ext/string.rb +19 -0
  70. data/lib/cucumber/{formatters → formatter}/ansicolor.rb +11 -10
  71. data/lib/cucumber/formatter/console.rb +116 -0
  72. data/lib/cucumber/formatter/pretty.rb +158 -0
  73. data/lib/cucumber/formatter/profile.rb +77 -0
  74. data/lib/cucumber/formatter/progress.rb +68 -0
  75. data/lib/cucumber/formatter.rb +1 -0
  76. data/lib/cucumber/formatters/autotest_formatter.rb +0 -2
  77. data/lib/cucumber/formatters/html_formatter.rb +4 -3
  78. data/lib/cucumber/formatters/pretty_formatter.rb +1 -1
  79. data/lib/cucumber/formatters/unicode.rb +3 -3
  80. data/lib/cucumber/jbehave.rb +104 -0
  81. data/lib/cucumber/languages.yml +100 -73
  82. data/lib/cucumber/parser/basic.rb +0 -0
  83. data/lib/cucumber/parser/feature.rb +1694 -0
  84. data/lib/cucumber/parser/feature.tt +206 -0
  85. data/lib/cucumber/parser/file_parser.rb +50 -0
  86. data/lib/cucumber/parser/i18n.tt +26 -0
  87. data/lib/cucumber/parser/treetop_ext.rb +9 -0
  88. data/lib/cucumber/parser.rb +27 -0
  89. data/lib/cucumber/platform.rb +3 -17
  90. data/lib/cucumber/step_definition.rb +83 -0
  91. data/lib/cucumber/step_mother.rb +128 -72
  92. data/lib/cucumber/version.rb +1 -1
  93. data/lib/cucumber.rb +56 -9
  94. data/spec/cucumber/ast/feature_factory.rb +54 -0
  95. data/spec/cucumber/ast/feature_spec.rb +60 -0
  96. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  97. data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
  98. data/spec/cucumber/ast/scenario_spec.rb +82 -0
  99. data/spec/cucumber/ast/step_spec.rb +45 -0
  100. data/spec/cucumber/ast/table_spec.rb +81 -0
  101. data/spec/cucumber/broadcaster_spec.rb +4 -17
  102. data/spec/cucumber/cli_spec.rb +43 -148
  103. data/spec/cucumber/core_ext/proc_spec.rb +27 -35
  104. data/spec/cucumber/core_ext/string_spec.rb +8 -0
  105. data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
  106. data/spec/cucumber/formatter/html/cucumber.css +37 -0
  107. data/spec/cucumber/formatter/html/cucumber.js +11 -0
  108. data/spec/cucumber/formatter/html/index.html +45 -0
  109. data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
  110. data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
  111. data/spec/cucumber/formatters/autotest_formatter_spec.rb +1 -0
  112. data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
  113. data/spec/cucumber/parser/feature_parser_spec.rb +247 -0
  114. data/spec/cucumber/parser/table_parser_spec.rb +48 -0
  115. data/spec/cucumber/step_definition_spec.rb +62 -0
  116. data/spec/cucumber/step_mom_spec.rb +49 -0
  117. data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
  118. data/spec/cucumber/treetop_parser/spaces.feature +3 -1
  119. data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
  120. data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
  121. data/spec/cucumber/world/pending_spec.rb +13 -12
  122. data/spec/spec_helper.rb +1 -1
  123. metadata +59 -67
  124. data/examples/calculator_ruby_features/Rakefile +0 -6
  125. data/examples/calculator_ruby_features/features/addition.rb +0 -39
  126. data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
  127. data/gem_tasks/treetop.rake +0 -41
  128. data/lib/cucumber/executor.rb +0 -205
  129. data/lib/cucumber/formatters/profile_formatter.rb +0 -92
  130. data/lib/cucumber/formatters/progress_formatter.rb +0 -61
  131. data/lib/cucumber/formatters.rb +0 -1
  132. data/lib/cucumber/model/table.rb +0 -32
  133. data/lib/cucumber/model.rb +0 -1
  134. data/lib/cucumber/step_methods.rb +0 -49
  135. data/lib/cucumber/tree/feature.rb +0 -105
  136. data/lib/cucumber/tree/features.rb +0 -21
  137. data/lib/cucumber/tree/given_scenario.rb +0 -13
  138. data/lib/cucumber/tree/scenario.rb +0 -240
  139. data/lib/cucumber/tree/step.rb +0 -173
  140. data/lib/cucumber/tree/table.rb +0 -26
  141. data/lib/cucumber/tree/top_down_visitor.rb +0 -23
  142. data/lib/cucumber/tree.rb +0 -16
  143. data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
  144. data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
  145. data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
  146. data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
  147. data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
  148. data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
  149. data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
  150. data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
  151. data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
  152. data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
  153. data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
  154. data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
  155. data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
  156. data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
  157. data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
  158. data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
  159. data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
  160. data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
  161. data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
  162. data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
  163. data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
  164. data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
  165. data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
  166. data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
  167. data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
  168. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
  169. data/lib/cucumber/world/pending.rb +0 -22
  170. data/lib/cucumber/world.rb +0 -1
  171. data/setup.rb +0 -1585
  172. data/spec/cucumber/executor_spec.rb +0 -382
  173. data/spec/cucumber/formatters/html_formatter_spec.rb +0 -104
  174. data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
  175. data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
  176. data/spec/cucumber/model/table_spec.rb +0 -32
  177. data/spec/cucumber/step_mother_spec.rb +0 -74
  178. data/spec/cucumber/tree/feature_spec.rb +0 -122
  179. data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
  180. data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
  181. data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
  182. data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
  183. data/spec/cucumber/tree/scenario_spec.rb +0 -134
  184. data/spec/cucumber/tree/step_outline_spec.rb +0 -17
  185. data/spec/cucumber/tree/step_spec.rb +0 -59
  186. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
@@ -1,99 +1,95 @@
1
1
  Feature: Cucumber command line
2
2
  In order to write better software
3
3
  Developers should be able to execute requirements as tests
4
-
4
+
5
5
  Scenario: Run single scenario with missing step definition
6
- When I run cucumber -q features/sample.feature:3
6
+ When I run cucumber -q features/sample.feature:5
7
7
  Then it should pass with
8
8
  """
9
+ @one
9
10
  Feature: Sample
11
+
12
+ @two @three
10
13
  Scenario: Missing
11
14
  Given missing
12
15
 
13
-
14
16
  1 scenario
15
- 1 step pending (1 with no step definition)
16
-
17
+ 1 undefined step
18
+
17
19
  """
18
-
19
- Scenario: Run single failing scenario
20
- When I run cucumber -q features/sample.feature:12
20
+
21
+ Scenario: Fail with --strict
22
+ When I run cucumber -q features/sample.feature:5 --strict
21
23
  Then it should fail with
22
24
  """
25
+ @one
23
26
  Feature: Sample
24
- Scenario: Failing
25
- Given failing
26
- FAIL (RuntimeError)
27
- ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
28
- features/sample.feature:12:in `Given failing'
29
27
 
28
+ @two @three
29
+ Scenario: Missing
30
+ Given missing
30
31
 
31
32
  1 scenario
32
- 1 step failed
33
+ 1 undefined step
33
34
 
34
35
  """
35
36
 
36
- Scenario: Specify 2 line numbers
37
- When I run cucumber -q features/sample.feature:3:12
37
+ Scenario: Specify 2 line numbers where one is a tag
38
+ When I run cucumber -q features/sample.feature:5:14
38
39
  Then it should fail with
39
40
  """
41
+ @one
40
42
  Feature: Sample
43
+
44
+ @two @three
41
45
  Scenario: Missing
42
46
  Given missing
43
47
 
48
+ @four
44
49
  Scenario: Failing
45
50
  Given failing
46
51
  FAIL (RuntimeError)
47
- ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
48
- features/sample.feature:12:in `Given failing'
49
-
52
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
53
+ ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
54
+ features/sample.feature:16:in `Given failing'
50
55
 
51
56
  2 scenarios
52
- 1 step failed
53
- 1 step pending (1 with no step definition)
57
+ 1 failed step
58
+ 1 undefined step
54
59
 
55
60
  """
56
61
 
57
-
58
62
  Scenario: Require missing step definition from elsewhere
59
- When I run cucumber -q -r ../../features/step_definitions/extra_steps.rb features/sample.feature:3
63
+ When I run cucumber -q -r ../../features/step_definitions/extra_steps.rb features/sample.feature:5
60
64
  Then it should pass with
61
65
  """
66
+ @one
62
67
  Feature: Sample
68
+
69
+ @two @three
63
70
  Scenario: Missing
64
71
  Given missing
65
72
 
66
-
67
- 1 scenario
68
- 1 step passed
69
-
70
- """
71
-
72
- Scenario: Specify the line number of a blank line
73
- When I run cucumber -q features/sample.feature:10
74
- Then it should pass with
75
- """
76
- Feature: Sample
77
- Scenario: Passing
78
- Given passing
79
-
80
-
81
73
  1 scenario
82
- 1 step passed
74
+ 1 passed step
83
75
 
84
76
  """
85
77
 
86
78
  Scenario: Specify the line number of a row
87
- When I run cucumber -q features/sample.feature:8
79
+ When I run cucumber -q features/sample.feature:12
88
80
  Then it should pass with
89
81
  """
82
+ @one
90
83
  Feature: Sample
84
+
85
+ @three
91
86
  Scenario: Passing
92
87
  Given passing
93
-
88
+ | a | b |
89
+ | c | d |
94
90
 
95
91
  1 scenario
96
- 1 step passed
92
+ 1 passed step
97
93
 
98
94
  """
99
95
 
@@ -101,19 +97,19 @@ Feature: Cucumber command line
101
97
  When I run cucumber -q --format progress features/sample.feature
102
98
  Then it should fail with
103
99
  """
104
- P.F
100
+ U.F
101
+
102
+ (::) failed steps (::)
105
103
 
106
- Pending Scenarios:
107
-
108
- 1) Sample (Missing)
109
-
110
-
111
- Failed:
112
-
113
- 1)
114
- FAIL
115
- ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
116
- features/sample.feature:12:in `Given failing'
104
+ FAIL (RuntimeError)
105
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
106
+ ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
107
+ features/sample.feature:16:in `Given failing'
108
+
109
+ 3 scenarios
110
+ 1 failed step
111
+ 1 undefined step
112
+ 1 passed step
117
113
 
118
114
  """
119
115
 
@@ -126,12 +122,14 @@ Feature: Cucumber command line
126
122
  For å slippe å gjøre dumme feil
127
123
  Som en regnskapsfører
128
124
  Vil jeg kunne legge sammen
125
+
129
126
  Scenario: to tall
130
127
  Gitt at jeg har tastet inn 5
131
128
  Og at jeg har tastet inn 7
132
129
  Når jeg summerer
133
130
  Så skal resultatet være 12
134
131
 
132
+ @iterasjon3
135
133
  Scenario: tre tall
136
134
  Gitt at jeg har tastet inn 5
137
135
  Og at jeg har tastet inn 7
@@ -139,85 +137,189 @@ Feature: Cucumber command line
139
137
  Når jeg summerer
140
138
  Så skal resultatet være 13
141
139
 
142
-
143
140
  2 scenarios
144
- 9 steps passed
141
+ 9 passed steps
145
142
 
146
143
  """
147
144
 
148
145
  Scenario: --dry-run
149
- When I run cucumber --dry-run features
146
+ When I run cucumber --dry-run --no-snippets features
150
147
  Then it should pass with
151
148
  """
152
- Feature: Outline Sample # features/outline_sample.feature
153
- Scenario Outline: Test state # features/outline_sample.feature:3
154
- Given <state> without a table # features/outline_sample.feature:4
149
+ Feature: Calling undefined step
155
150
 
156
- |state |
157
- |missing|
158
- |passing|
159
- |failing|
151
+ Scenario: Call directly
152
+ Given a step definition that calls an undefined step
160
153
 
161
- Feature: Sample # features/sample.feature
154
+ Scenario: Call via another
155
+ Given call step "a step definition that calls an undefined step"
162
156
 
163
- Scenario: Missing # features/sample.feature:3
164
- Given missing # other.rb:23
157
+ Feature: Lots of undefined
165
158
 
166
- Scenario: Passing # features/sample.feature:6
167
- Given passing # features/step_definitions/sample_steps.rb:1
159
+ Scenario: Implement me
160
+ Given it snows in Sahara
161
+ Given it's 40 degrees in Norway
162
+ And it's 40 degrees in Norway
163
+ When I stop procrastinating
164
+ And there is world peace
168
165
 
169
- Scenario: Failing # features/sample.feature:11
170
- Given failing # features/step_definitions/sample_steps.rb:4
166
+ Feature: Outline Sample
171
167
 
168
+ Scenario: I have no steps
172
169
 
173
- 7 scenarios
174
- 6 steps passed
170
+ Scenario Outline: Test state
171
+ Given <state> without a table
172
+ Given <other_state> without a table
173
+
174
+ Examples:
175
+ | state | other_state |
176
+ | missing | passing |
177
+ | passing | passing |
178
+ | failing | passing |
179
+
180
+ @one
181
+ Feature: Sample
182
+
183
+ @two @three
184
+ Scenario: Missing
185
+ Given missing
186
+
187
+ @three
188
+ Scenario: Passing
189
+ Given passing
190
+ | a | b |
191
+ | c | d |
192
+
193
+ @four
194
+ Scenario: Failing
195
+ Given failing
196
+
197
+ 10 scenarios
198
+ 9 skipped steps
199
+ 7 undefined steps
175
200
 
176
201
  """
177
202
 
178
203
  Scenario: Multiple formatters and outputs
179
- When I run cucumber --format progress --out tmp/progress.txt --format html --out tmp/features.html features
180
- Then it should fail with
204
+ When I run cucumber --format progress --out tmp/progress.txt --format pretty --out tmp/pretty.txt --dry-run features/lots_of_undefined.feature
205
+ And examples/self_test/tmp/progress.txt should contain
181
206
  """
207
+ UUUUU
208
+
209
+ 1 scenario
210
+ 5 undefined steps
211
+
182
212
  """
183
- And examples/self_test/tmp/progress.txt should contain
213
+ And examples/self_test/tmp/pretty.txt should match
184
214
  """
185
- P.FP.F
215
+ Feature: Lots of undefined
186
216
 
187
- Pending Scenarios:
217
+ Scenario: Implement me
218
+ Given it snows in Sahara
219
+ Given it's 40 degrees in Norway
220
+ And it's 40 degrees in Norway
221
+ When I stop procrastinating
222
+ And there is world peace
188
223
 
189
- 1) Outline Sample (Test state)
190
- 2) Sample (Missing)
224
+ 1 scenario
225
+ 5 undefined steps
191
226
 
227
+ """
192
228
 
193
- Failed:
229
+ Scenario: Run scenario specified by name using --scenario
230
+ When I run cucumber --scenario Passing -q features
231
+ Then it should pass with
232
+ """
233
+ @one
234
+ Feature: Sample
194
235
 
195
- 1)
196
- FAIL
197
- ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
198
- features/outline_sample.feature:9:in `/^failing without a table$/'
236
+ @three
237
+ Scenario: Passing
238
+ Given passing
239
+ | a | b |
240
+ | c | d |
199
241
 
200
- 2)
201
- FAIL
202
- ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
203
- features/sample.feature:12:in `Given failing'
242
+ 1 scenario
243
+ 1 passed step
204
244
 
205
245
  """
206
- And examples/self_test/tmp/features.html should match
246
+
247
+ Scenario: Run with a tag that exists on 2 scenarios
248
+ When I run cucumber -q features --tags three
249
+ Then it should pass with
207
250
  """
208
- Given passing
251
+ @one
252
+ Feature: Sample
253
+
254
+ @two @three
255
+ Scenario: Missing
256
+ Given missing
257
+
258
+ @three
259
+ Scenario: Passing
260
+ Given passing
261
+ | a | b |
262
+ | c | d |
263
+
264
+ 2 scenarios
265
+ 1 undefined step
266
+ 1 passed step
267
+
209
268
  """
210
-
211
- Scenario: Run scenario specified by name using --scenario
212
- When I run cucumber --scenario Passing -q features/sample.feature
213
- Then it should pass with
269
+
270
+ Scenario: Run with a tag that exists on 1 feature
271
+ When I run cucumber -q features --tags one
272
+ Then it should fail with
214
273
  """
274
+ @one
215
275
  Feature: Sample
276
+
277
+ @two @three
278
+ Scenario: Missing
279
+ Given missing
280
+
281
+ @three
216
282
  Scenario: Passing
217
283
  Given passing
284
+ | a | b |
285
+ | c | d |
218
286
 
287
+ @four
288
+ Scenario: Failing
289
+ Given failing
290
+ FAIL (RuntimeError)
291
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
292
+ ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
293
+ features/sample.feature:16:in `Given failing'
219
294
 
220
- 1 scenario
221
- 1 step passed
295
+ 3 scenarios
296
+ 1 failed step
297
+ 1 undefined step
298
+ 1 passed step
299
+
300
+ """
222
301
 
302
+ Scenario: Reformat files with --autoformat
303
+ When I run cucumber --autoformat tmp/formatted features
304
+ Then examples/self_test/tmp/formatted/features/sample.feature should contain
223
305
  """
306
+ @one
307
+ Feature: Sample
308
+
309
+ @two @three
310
+ Scenario: Missing
311
+ Given missing
312
+
313
+ @three
314
+ Scenario: Passing
315
+ Given passing
316
+ | a | b |
317
+ | c | d |
318
+
319
+ @four
320
+ Scenario: Failing
321
+ Given failing
322
+
323
+
324
+ """
325
+
@@ -1,54 +1,56 @@
1
1
  Feature: Cucumber command line
2
2
  In order to write better software
3
3
  Developers should be able to execute requirements as tests
4
-
5
- Scenario: Run scenario outline steps only
6
- When I run cucumber -q features/outline_sample.feature:3
7
- Then it should pass with
8
- """
9
- Feature: Outline Sample
10
- Scenario Outline: Test state
11
- Given <state> without a table
12
4
 
13
- |state |
14
-
15
- 1 scenario
16
-
17
- """
18
-
19
- Scenario: Run single scenario outline table row with missing step definition
5
+ Scenario: Run scenario outline steps only
20
6
  When I run cucumber -q features/outline_sample.feature:7
21
- Then it should pass with
7
+ Then it should fail with
22
8
  """
23
9
  Feature: Outline Sample
10
+
24
11
  Scenario Outline: Test state
25
12
  Given <state> without a table
13
+ Given <other_state> without a table
26
14
 
27
- |state |
28
- |missing|
15
+ Examples:
16
+ | state | other_state |
17
+ | missing | passing |
18
+ | passing | passing |
19
+ | failing | passing |
20
+ FAIL (RuntimeError)
21
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
22
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
23
+ features/outline_sample.feature:12:in `Given failing without a table'
24
+
25
+ 3 scenarios
26
+ 1 failed step
27
+ 2 skipped steps
28
+ 1 undefined step
29
+ 2 passed steps
29
30
 
30
- 2 scenarios
31
- 1 step pending (1 with no step definition)
32
-
33
31
  """
34
32
 
35
33
  Scenario: Run single failing scenario outline table row
36
- When I run cucumber -q features/outline_sample.feature:9
34
+ When I run cucumber features/outline_sample.feature:12
37
35
  Then it should fail with
38
36
  """
39
37
  Feature: Outline Sample
40
- Scenario Outline: Test state
41
- Given <state> without a table
42
38
 
43
- |state |
44
- |failing|
39
+ Scenario Outline: Test state # features/outline_sample.feature:5
40
+ Given <state> without a table
41
+ Given <other_state> without a table
45
42
 
43
+ Examples:
44
+ | state | other_state |
45
+ | failing | passing |
46
46
  FAIL (RuntimeError)
47
- ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
48
- features/outline_sample.feature:9:in `/^failing without a table$/'
47
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
48
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
49
+ features/outline_sample.feature:12:in `Given failing without a table'
49
50
 
50
- 2 scenarios
51
- 1 step failed
51
+ 1 scenario
52
+ 1 failed step
53
+ 1 skipped step
52
54
 
53
55
  """
54
56
 
@@ -56,18 +58,24 @@ Feature: Cucumber command line
56
58
  When I run cucumber -q --format progress features/outline_sample.feature
57
59
  Then it should fail with
58
60
  """
59
- P.F
61
+ UUS..FS
60
62
 
61
- Pending Scenarios:
63
+ (::) undefined scenarios (::)
62
64
 
63
- 1) Outline Sample (Test state)
65
+ features/outline_sample.feature:3:in `Scenario: I have no steps'
64
66
 
67
+ (::) failed steps (::)
65
68
 
66
- Failed:
69
+ FAIL (RuntimeError)
70
+ ./features/step_definitions/sample_steps.rb:2:in `flunker'
71
+ ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
72
+ features/outline_sample.feature:12:in `Given failing without a table'
67
73
 
68
- 1)
69
- FAIL
70
- ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
71
- features/outline_sample.feature:9:in `/^failing without a table$/'
74
+ 4 scenarios
75
+ 1 failed step
76
+ 2 skipped steps
77
+ 1 undefined step
78
+ 2 passed steps
72
79
 
73
80
  """
81
+
@@ -0,0 +1,31 @@
1
+ Feature: Cucumber command line
2
+ In order to find out what step definitions need to be implemented
3
+ Developers should always see what step definition is missing
4
+
5
+ Scenario: Get info at arbitrary levels of nesting
6
+ When I run cucumber features/call_undefined_step_from_step_def.feature
7
+ Then it should pass with
8
+ """
9
+ Feature: Calling undefined step
10
+
11
+ Scenario: Call directly # features/call_undefined_step_from_step_def.feature:3
12
+ Given a step definition that calls an undefined step # features/step_definitions/sample_steps.rb:19
13
+ Undefined step: "this does not exist" (Cucumber::StepMother::Undefined)
14
+ ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
15
+
16
+ Scenario: Call via another # features/call_undefined_step_from_step_def.feature:6
17
+ Given call step "a step definition that calls an undefined step" # features/step_definitions/sample_steps.rb:23
18
+ Undefined step: "this does not exist" (Cucumber::StepMother::Undefined)
19
+ ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
20
+
21
+ 2 scenarios
22
+ 2 undefined steps
23
+
24
+ You can implement step definitions for missing steps with these snippets:
25
+
26
+ Given /^this does not exist$/ do
27
+ end
28
+
29
+
30
+ """
31
+
@@ -6,16 +6,20 @@ When /^I run cucumber (.*)$/ do |cmd|
6
6
  @dir ||= 'self_test'
7
7
  full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/#{@dir}")
8
8
  Dir.chdir(full_dir) do
9
- @full_cmd = "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{cmd}"
9
+ @full_cmd = "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} --no-color #{cmd}"
10
10
  @out = `#{@full_cmd}`
11
11
  @status = $?.exitstatus
12
12
  end
13
13
  end
14
14
 
15
15
  Then /^it should (fail|pass) with$/ do |success, output|
16
+ #puts @out
16
17
  @out.should == output
17
- code = success == 'fail' ? 1 : 0
18
- @status.should == code
18
+ if success == 'fail'
19
+ @status.should_not == 0
20
+ else
21
+ @status.should == 0
22
+ end
19
23
  end
20
24
 
21
25
  Then /^(.*) should contain$/ do |file, text|
@@ -1,2 +1,2 @@
1
1
  Given /^missing$/ do
2
- end
2
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec/expectations'
2
2
  require 'fileutils'
3
3
 
4
- Before do
4
+ After do
5
5
  FileUtils.rm_rf 'examples/self_test/tmp'
6
6
  FileUtils.mkdir 'examples/self_test/tmp'
7
7
  end
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
2
2
  require 'cucumber/rake/task'
3
3
 
4
4
  Cucumber::Rake::Task.new do |t|
5
- t.cucumber_opts = "--format pretty"
5
+ t.cucumber_opts = "--format progress"
6
6
  end
data/gem_tasks/flog.rake CHANGED
@@ -1,4 +1,4 @@
1
1
  desc "Run flog over significant files"
2
2
  task :flog do
3
- sh "find lib -name \\*.rb | grep -v feature_..\\.rb | xargs flog"
3
+ sh "find lib/cucumber -name \\*.rb | grep -v parser\/feature\\.rb | xargs flog"
4
4
  end