aslakhellesoy-cucumber 0.3.5 → 0.3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/History.txt +24 -0
  2. data/Manifest.txt +5 -2
  3. data/examples/i18n/fr/features/addition.feature +4 -4
  4. data/features/after_block_exceptions.feature +97 -0
  5. data/features/after_step_block_exceptions.feature +99 -0
  6. data/features/background.feature +47 -2
  7. data/features/custom_formatter.feature +1 -1
  8. data/features/step_definitions/cucumber_steps.rb +8 -0
  9. data/features/work_in_progress.feature +146 -0
  10. data/lib/cucumber.rb +5 -0
  11. data/lib/cucumber/ast/background.rb +3 -3
  12. data/lib/cucumber/ast/outline_table.rb +51 -4
  13. data/lib/cucumber/ast/scenario.rb +9 -3
  14. data/lib/cucumber/ast/scenario_outline.rb +4 -0
  15. data/lib/cucumber/ast/step.rb +3 -3
  16. data/lib/cucumber/ast/step_invocation.rb +13 -4
  17. data/lib/cucumber/cli/configuration.rb +54 -23
  18. data/lib/cucumber/cli/main.rb +6 -2
  19. data/lib/cucumber/formatter/console.rb +9 -0
  20. data/lib/cucumber/formatter/junit.rb +1 -1
  21. data/lib/cucumber/formatter/pretty.rb +7 -2
  22. data/lib/cucumber/formatter/progress.rb +1 -0
  23. data/lib/cucumber/formatter/tag_cloud.rb +27 -0
  24. data/lib/cucumber/languages.yml +60 -60
  25. data/lib/cucumber/rails/world.rb +16 -3
  26. data/lib/cucumber/rake/task.rb +2 -2
  27. data/lib/cucumber/step_match.rb +3 -2
  28. data/lib/cucumber/step_mother.rb +29 -4
  29. data/lib/cucumber/version.rb +2 -2
  30. data/rails_generators/cucumber/templates/cucumber.rake +1 -1
  31. data/rails_generators/feature/feature_generator.rb +1 -1
  32. data/spec/cucumber/cli/configuration_spec.rb +0 -3
  33. data/spec/cucumber/formatter/color_io_spec.rb +1 -0
  34. data/spec/cucumber/formatter/progress_spec.rb +1 -0
  35. metadata +6 -4
  36. data/examples/self_test/features/support/tag_count_formatter.rb +0 -25
  37. data/lib/cucumber/formatter.rb +0 -1
data/History.txt CHANGED
@@ -1,3 +1,27 @@
1
+ == 0.3.7 2209-05-21
2
+
3
+ === New Features
4
+ * New --expand option. This will print Scenario Outlines once for each Example row - with values expanded. (#327 Aslak Hellesøy)
5
+ * You can override the formatter in Rails-generated rake tasks with the CUCUMBER_FORMAT environment variable (#335 Aslak Hellesøy)
6
+
7
+ == 0.3.6 2009-05-20
8
+
9
+ Kanban! With this release you can tag features or scenarios that are work in progress
10
+ with a tag and use the new --wip switch.
11
+
12
+ Another handy feature in this release is that you can package your own formatters in RubyGems.
13
+
14
+ === New features
15
+ * New --wip switch. See http://www.jroller.com/perryn/entry/bdd_on_a_multi_disciplined (Perryn Fowler)
16
+ * Added a AfterStep hook (Luke Melia)
17
+ * New aliases for Vietnamese (Ngoc Dao)
18
+ * Automatic require of custom formatters. --require is no longer needed to load them, and they can be in Ruby gems. (Aslak Hellesøy)
19
+ * Lazy loading of built-in formatters. Should improve startup time a little bit.
20
+
21
+ === Bugfixes
22
+ * Gracefully handle exceptions in After block (#330 Matt Wynne)
23
+ * Feature with only Background doesn't run hooks (#314, #329 Aslak Hellesøy)
24
+
1
25
  == 0.3.5 2009-05-14
2
26
 
3
27
  Let's make a new release today because two annoying bugs are fixed.
data/Manifest.txt CHANGED
@@ -190,7 +190,6 @@ examples/self_test/features/sample.feature
190
190
  examples/self_test/features/search_sample.feature
191
191
  examples/self_test/features/step_definitions/sample_steps.rb
192
192
  examples/self_test/features/support/env.rb
193
- examples/self_test/features/support/tag_count_formatter.rb
194
193
  examples/self_test/features/tons_of_cukes.feature
195
194
  examples/self_test/features/undefined_multiline_args.feature
196
195
  examples/sinatra/Rakefile
@@ -238,12 +237,15 @@ examples/watir/Rakefile
238
237
  examples/watir/features/search.feature
239
238
  examples/watir/features/step_definitons/search_steps.rb
240
239
  examples/watir/features/support/env.rb
240
+ features/after_block_exceptions.feature
241
+ features/after_step_block_exceptions.feature
241
242
  features/background.feature
242
243
  features/cucumber_cli.feature
243
244
  features/cucumber_cli_diff_disabled.feature
244
245
  features/cucumber_cli_outlines.feature
245
246
  features/custom_formatter.feature
246
247
  features/exclude_files.feature
248
+ features/expand.feature
247
249
  features/junit_formatter.feature
248
250
  features/multiline_names.feature
249
251
  features/rake_task.feature
@@ -253,6 +255,7 @@ features/step_definitions/cucumber_steps.rb
253
255
  features/step_definitions/extra_steps.rb
254
256
  features/support/env.rb
255
257
  features/usage.feature
258
+ features/work_in_progress.feature
256
259
  gem_tasks/deployment.rake
257
260
  gem_tasks/environment.rake
258
261
  gem_tasks/features.rake
@@ -293,7 +296,6 @@ lib/cucumber/core_ext/exception.rb
293
296
  lib/cucumber/core_ext/instance_exec.rb
294
297
  lib/cucumber/core_ext/proc.rb
295
298
  lib/cucumber/core_ext/string.rb
296
- lib/cucumber/formatter.rb
297
299
  lib/cucumber/formatter/ansicolor.rb
298
300
  lib/cucumber/formatter/color_io.rb
299
301
  lib/cucumber/formatter/console.rb
@@ -305,6 +307,7 @@ lib/cucumber/formatter/pretty.rb
305
307
  lib/cucumber/formatter/profile.rb
306
308
  lib/cucumber/formatter/progress.rb
307
309
  lib/cucumber/formatter/rerun.rb
310
+ lib/cucumber/formatter/tag_cloud.rb
308
311
  lib/cucumber/formatter/unicode.rb
309
312
  lib/cucumber/formatter/usage.rb
310
313
  lib/cucumber/formatters/unicode.rb
@@ -11,7 +11,7 @@ Fonctionnalité: Addition
11
11
  Lorsque je tape sur la touche "="
12
12
  Alors le résultat affiché doit être <somme>
13
13
 
14
- Exemples:
15
- | a | b | somme |
16
- | 2 | 2 | 4 |
17
- | 2 | 3 | 5 |
14
+ Exemples:
15
+ | a | b | somme |
16
+ | 2 | 2 | 4 |
17
+ | 2 | 3 | 5 |
@@ -0,0 +1,97 @@
1
+ Feature: After Block Exceptions
2
+ In order to use custom assertions at the end of each scenario
3
+ As a developer
4
+ I want exceptions raised in After blocks to be handled gracefully and reported by the formatters
5
+
6
+ Background:
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/step_definitions/steps.rb" with:
9
+ """
10
+ Given /^this step does something naughty$/ do
11
+ @naughty = true
12
+ end
13
+
14
+ Given /^this step works$/ do
15
+ end
16
+ """
17
+ And a file named "features/support/env.rb" with:
18
+ """
19
+ class NaughtyScenarioException < Exception; end
20
+ After do
21
+ if @naughty
22
+ raise NaughtyScenarioException.new("This scenario has been very very naughty")
23
+ end
24
+ end
25
+ """
26
+
27
+ Scenario: Handle Exception in standard scenario step and carry on
28
+ Given a file named "features/naughty_step_in_scenario.feature" with:
29
+ """
30
+ Feature: Sample
31
+
32
+ Scenario: Naughty Step
33
+ Given this step does something naughty
34
+
35
+ Scenario: Success
36
+ Given this step works
37
+ """
38
+ When I run cucumber features
39
+ Then it should fail with
40
+ """
41
+ Feature: Sample
42
+
43
+ Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
44
+ Given this step does something naughty # features/step_definitions/steps.rb:1
45
+ This scenario has been very very naughty (NaughtyScenarioException)
46
+ ./features/support/env.rb:4:in `After'
47
+
48
+ Scenario: Success # features/naughty_step_in_scenario.feature:6
49
+ Given this step works # features/step_definitions/steps.rb:5
50
+
51
+ 2 scenarios (1 failed, 1 passed)
52
+ 2 steps (2 passed)
53
+
54
+ """
55
+
56
+ Scenario: Handle Exception in scenario outline table row and carry on
57
+ Given a file named "features/naughty_step_in_scenario_outline.feature" with:
58
+ """
59
+ Feature: Sample
60
+
61
+ Scenario Outline: Naughty Step
62
+ Given this step <Might Work>
63
+
64
+ Examples:
65
+ | Might Work |
66
+ | works |
67
+ | does something naughty |
68
+ | works |
69
+
70
+ Scenario: Success
71
+ Given this step works
72
+
73
+ """
74
+ When I run cucumber features
75
+ Then it should fail with
76
+ """
77
+ Feature: Sample
78
+
79
+ Scenario Outline: Naughty Step # features/naughty_step_in_scenario_outline.feature:3
80
+ Given this step <Might Work> # features/step_definitions/steps.rb:5
81
+
82
+ Examples:
83
+ | Might Work |
84
+ | works |
85
+ | does something naughty |
86
+ This scenario has been very very naughty (NaughtyScenarioException)
87
+ ./features/support/env.rb:4:in `After'
88
+ | works |
89
+
90
+ Scenario: Success # features/naughty_step_in_scenario_outline.feature:12
91
+ Given this step works # features/step_definitions/steps.rb:5
92
+
93
+ 4 scenarios (1 failed, 3 passed)
94
+ 4 steps (4 passed)
95
+
96
+ """
97
+
@@ -0,0 +1,99 @@
1
+ Feature: AfterStep Block Exceptions
2
+ In order to use custom assertions at the end of each step
3
+ As a developer
4
+ I want exceptions raised in AfterStep blocks to be handled gracefully and reported by the formatters
5
+
6
+ Background:
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/step_definitions/steps.rb" with:
9
+ """
10
+ Given /^this step does something naughty$/ do
11
+ @naughty = true
12
+ end
13
+
14
+ Given /^this step works$/ do
15
+ end
16
+ """
17
+ And a file named "features/support/env.rb" with:
18
+ """
19
+ class NaughtyStepException < Exception; end
20
+ AfterStep do
21
+ if @naughty
22
+ raise NaughtyStepException.new("This step has been very very naughty")
23
+ end
24
+ end
25
+ """
26
+
27
+ Scenario: Handle Exception in standard scenario step and carry on
28
+ Given a file named "features/naughty_step_in_scenario.feature" with:
29
+ """
30
+ Feature: Sample
31
+
32
+ Scenario: Naughty Step
33
+ Given this step does something naughty
34
+
35
+ Scenario: Success
36
+ Given this step works
37
+ """
38
+ When I run cucumber features
39
+ Then it should fail with
40
+ """
41
+ Feature: Sample
42
+
43
+ Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
44
+ Given this step does something naughty # features/step_definitions/steps.rb:1
45
+ This step has been very very naughty (NaughtyStepException)
46
+ ./features/support/env.rb:4:in `AfterStep'
47
+ features/naughty_step_in_scenario.feature:4:in `Given this step does something naughty'
48
+
49
+ Scenario: Success # features/naughty_step_in_scenario.feature:6
50
+ Given this step works # features/step_definitions/steps.rb:5
51
+
52
+ 2 scenarios (1 failed, 1 passed)
53
+ 2 steps (1 failed, 1 passed)
54
+
55
+ """
56
+
57
+ Scenario: Handle Exception in scenario outline table row and carry on
58
+ Given a file named "features/naughty_step_in_scenario_outline.feature" with:
59
+ """
60
+ Feature: Sample
61
+
62
+ Scenario Outline: Naughty Step
63
+ Given this step <Might Work>
64
+
65
+ Examples:
66
+ | Might Work |
67
+ | works |
68
+ | does something naughty |
69
+ | works |
70
+
71
+ Scenario: Success
72
+ Given this step works
73
+
74
+ """
75
+ When I run cucumber features
76
+ Then it should fail with
77
+ """
78
+ Feature: Sample
79
+
80
+ Scenario Outline: Naughty Step # features/naughty_step_in_scenario_outline.feature:3
81
+ Given this step <Might Work> # features/step_definitions/steps.rb:5
82
+
83
+ Examples:
84
+ | Might Work |
85
+ | works |
86
+ | does something naughty |
87
+ This step has been very very naughty (NaughtyStepException)
88
+ ./features/support/env.rb:4:in `AfterStep'
89
+ features/naughty_step_in_scenario_outline.feature:4:in `Given this step <Might Work>'
90
+ | works |
91
+
92
+ Scenario: Success # features/naughty_step_in_scenario_outline.feature:12
93
+ Given this step works # features/step_definitions/steps.rb:5
94
+
95
+ 4 scenarios (1 failed, 3 passed)
96
+ 4 steps (1 failed, 3 passed)
97
+
98
+ """
99
+
@@ -253,5 +253,50 @@ Feature: backgrounds
253
253
 
254
254
  """
255
255
 
256
- @josephwilk
257
- Scenario: run a scenario showing explicit background steps --explicit-background
256
+ Scenario: https://rspec.lighthouseapp.com/projects/16211/tickets/329
257
+ Given a standard Cucumber project directory structure
258
+ And a file named "features/only_background_and_hooks.feature" with:
259
+ """
260
+ Feature: woo yeah
261
+
262
+ Background:
263
+ Given whatever
264
+
265
+ """
266
+ And a file named "features/only_background_and_hooks_steps.rb" with:
267
+ """
268
+ require 'spec/expectations'
269
+
270
+ Before do
271
+ $before = true
272
+ end
273
+
274
+ After do
275
+ $after = true
276
+ end
277
+
278
+ Given /^whatever$/ do
279
+ $before.should == true
280
+ $step = true
281
+ end
282
+
283
+ at_exit do
284
+ $before.should == true
285
+ $step.should == true
286
+ $after.should == true
287
+ end
288
+ """
289
+ When I run cucumber features/only_background_and_hooks.feature
290
+ Then it should pass
291
+ And the output should be
292
+ """
293
+ Feature: woo yeah
294
+
295
+ Background: # features/only_background_and_hooks.feature:3
296
+ Given whatever # features/only_background_and_hooks_steps.rb:11
297
+
298
+ 0 scenarios
299
+ 1 step (1 passed)
300
+
301
+ """
302
+ And STDERR should be empty
@@ -1,7 +1,7 @@
1
1
  Feature: Custom Formatter
2
2
 
3
3
  Scenario: count tags
4
- When I run cucumber --format Tag::Count features
4
+ When I run cucumber --format Cucumber::Formatter::TagCloud features
5
5
  Then it should fail with
6
6
  """
7
7
  | after_file | background_tagged_before_on_outline | four | lots | one | three | two |
@@ -62,6 +62,10 @@ Then /^the output should not contain$/ do |text|
62
62
  last_stdout.should_not include(text)
63
63
  end
64
64
 
65
+ Then /^the output should be$/ do |text|
66
+ last_stdout.should == text
67
+ end
68
+
65
69
  # http://diffxml.sourceforge.net/
66
70
  Then /^"(.*)" should contain XML$/ do |file, xml|
67
71
  t = Tempfile.new('cucumber-junit')
@@ -86,6 +90,10 @@ Then /^STDERR should match$/ do |text|
86
90
  last_stderr.should =~ /#{text}/
87
91
  end
88
92
 
93
+ Then /^STDERR should be empty$/ do
94
+ last_stderr.should == ""
95
+ end
96
+
89
97
  Then /^"(.*)" should exist$/ do |file|
90
98
  File.exists?(file).should be_true
91
99
  FileUtils.rm(file)
@@ -0,0 +1,146 @@
1
+ Feature: Cucumber --work-in-progress switch
2
+ In order to ensure that feature scenarios do not pass until they are expected to
3
+ Developers should be able to run cucumber in a mode that
4
+ - will fail if any scenario passes completely
5
+ - will not fail otherwise
6
+
7
+ Background: A passing and a pending feature
8
+ Given a standard Cucumber project directory structure
9
+ Given a file named "features/wip.feature" with:
10
+ """
11
+ Feature: WIP
12
+ @failing
13
+ Scenario: Failing
14
+ Given a failing step
15
+
16
+ @undefined
17
+ Scenario: Undefined
18
+ Given an undefined step
19
+
20
+ @pending
21
+ Scenario: Pending
22
+ Given a pending step
23
+
24
+ @passing
25
+ Scenario: Passing
26
+ Given a passing step
27
+ """
28
+ And a file named "features/passing_outline.feature" with:
29
+ """
30
+ Feature: Not WIP
31
+ Scenario Outline: Passing
32
+ Given a <what> step
33
+
34
+ Examples:
35
+ | what |
36
+ | passing |
37
+ """
38
+ And a file named "features/step_definitions/steps.rb" with:
39
+ """
40
+ Given /^a failing step$/ do
41
+ raise "I fail"
42
+ end
43
+
44
+ Given /^a passing step$/ do
45
+ end
46
+
47
+ Given /^a pending step$/ do
48
+ pending
49
+ end
50
+ """
51
+
52
+ Scenario: Pass with Failing Scenarios
53
+ When I run cucumber -q -w -t @failing features/wip.feature
54
+ Then it should pass with
55
+ """
56
+ Feature: WIP
57
+
58
+ @failing
59
+ Scenario: Failing
60
+ Given a failing step
61
+ I fail (RuntimeError)
62
+ ./features/step_definitions/steps.rb:2:in `/^a failing step$/'
63
+ features/wip.feature:4:in `Given a failing step'
64
+
65
+ 1 scenario (1 failed)
66
+ 1 step (1 failed)
67
+
68
+ """
69
+
70
+ Scenario: Pass with Undefined Scenarios
71
+ When I run cucumber -q -w -t @undefined features/wip.feature
72
+ Then it should pass with
73
+ """
74
+ Feature: WIP
75
+
76
+ @undefined
77
+ Scenario: Undefined
78
+ Given an undefined step
79
+
80
+ 1 scenario (1 undefined)
81
+ 1 step (1 undefined)
82
+
83
+ """
84
+
85
+ Scenario: Pass with Undefined Scenarios
86
+ When I run cucumber -q -w -t @pending features/wip.feature
87
+ Then it should pass with
88
+ """
89
+ Feature: WIP
90
+
91
+ @pending
92
+ Scenario: Pending
93
+ Given a pending step
94
+ TODO (Cucumber::Pending)
95
+ ./features/step_definitions/steps.rb:9:in `/^a pending step$/'
96
+ features/wip.feature:12:in `Given a pending step'
97
+
98
+ 1 scenario (1 pending)
99
+ 1 step (1 pending)
100
+
101
+ """
102
+
103
+ Scenario: Fail with Passing Scenarios
104
+ When I run cucumber -q -w -t @passing features/wip.feature
105
+ Then it should fail with
106
+ """
107
+ Feature: WIP
108
+
109
+ @passing
110
+ Scenario: Passing
111
+ Given a passing step
112
+
113
+ 1 scenario (1 passed)
114
+ 1 step (1 passed)
115
+
116
+ The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:
117
+ (::) passed scenarios (::)
118
+
119
+ features/wip.feature:15:in `Scenario: Passing'
120
+
121
+
122
+ """
123
+
124
+ Scenario: Fail with Passing Scenario Outline
125
+ When I run cucumber -q -w features/passing_outline.feature
126
+ Then it should fail with
127
+ """
128
+ Feature: Not WIP
129
+
130
+ Scenario Outline: Passing
131
+ Given a <what> step
132
+
133
+ Examples:
134
+ | what |
135
+ | passing |
136
+
137
+ 1 scenario (1 passed)
138
+ 1 step (1 passed)
139
+
140
+ The --wip switch was used, so I didn't expect anything to pass. These scenarios passed:
141
+ (::) passed scenarios (::)
142
+
143
+ features/passing_outline.feature:7:in `| passing |'
144
+
145
+
146
+ """