cucumber 2.0.0.beta.3 → 2.0.0

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.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/History.md +131 -32
  4. data/Rakefile +0 -2
  5. data/cucumber.gemspec +4 -3
  6. data/examples/i18n/ht/Rakefile +6 -0
  7. data/examples/i18n/ht/features/adisyon.feature +17 -0
  8. data/examples/i18n/ht/features/divizyon.feature +10 -0
  9. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +25 -0
  10. data/examples/i18n/ht/lib/kalkilatris.rb +14 -0
  11. data/examples/tcl/features/step_definitions/fib_steps.rb +1 -1
  12. data/features/docs/cli/dry_run.feature +48 -0
  13. data/features/docs/cli/exclude_files.feature +1 -2
  14. data/features/docs/cli/run_specific_scenarios.feature +28 -66
  15. data/features/docs/cli/strict_mode.feature +24 -1
  16. data/features/docs/defining_steps/nested_steps.feature +49 -0
  17. data/features/docs/defining_steps/skip_scenario.feature +31 -2
  18. data/features/docs/defining_steps/snippets.feature +15 -0
  19. data/features/docs/exception_in_after_step_hook.feature +1 -1
  20. data/features/docs/exception_in_around_hook.feature +80 -0
  21. data/features/docs/extending_cucumber/custom_filter.feature +29 -0
  22. data/features/docs/extending_cucumber/custom_formatter.feature +65 -7
  23. data/features/docs/formatters/debug_formatter.feature +24 -17
  24. data/features/docs/formatters/json_formatter.feature +65 -1
  25. data/features/docs/formatters/junit_formatter.feature +40 -0
  26. data/features/docs/formatters/pretty_formatter.feature +42 -0
  27. data/features/docs/formatters/rerun_formatter.feature +3 -2
  28. data/features/docs/getting_started.feature +1 -1
  29. data/features/docs/{wire_protocol_erb.feature → wire_protocol/erb_configuration.feature} +2 -2
  30. data/features/docs/wire_protocol/handle_unexpected_response.feature +30 -0
  31. data/features/docs/wire_protocol/invoke_message.feature +216 -0
  32. data/features/docs/wire_protocol/readme.md +26 -0
  33. data/features/docs/wire_protocol/snippets_message.feature +51 -0
  34. data/features/docs/wire_protocol/step_matches_message.feature +81 -0
  35. data/features/docs/{wire_protocol_table_diffing.feature → wire_protocol/table_diffing.feature} +1 -0
  36. data/features/docs/{wire_protocol_tags.feature → wire_protocol/tags.feature} +1 -0
  37. data/features/docs/{wire_protocol_timeouts.feature → wire_protocol/timeouts.feature} +1 -0
  38. data/features/docs/work_in_progress.feature +1 -1
  39. data/features/docs/writing_support_code/after_hooks.feature +24 -0
  40. data/features/docs/writing_support_code/around_hooks.feature +31 -0
  41. data/features/docs/writing_support_code/before_hook.feature +7 -3
  42. data/features/docs/writing_support_code/tagged_hooks.feature +44 -6
  43. data/features/lib/step_definitions/wire_steps.rb +18 -1
  44. data/features/lib/support/fake_wire_server.rb +10 -7
  45. data/lib/cucumber/cli/configuration.rb +6 -11
  46. data/lib/cucumber/cli/main.rb +2 -2
  47. data/lib/cucumber/cli/options.rb +8 -1
  48. data/lib/cucumber/cli/profile_loader.rb +1 -1
  49. data/lib/cucumber/core_ext/instance_exec.rb +1 -1
  50. data/lib/cucumber/encoding.rb +5 -0
  51. data/lib/cucumber/errors.rb +8 -0
  52. data/lib/cucumber/file_specs.rb +3 -1
  53. data/lib/cucumber/filters/activate_steps.rb +33 -0
  54. data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
  55. data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
  56. data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
  57. data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
  58. data/lib/cucumber/{runtime → filters}/gated_receiver.rb +5 -1
  59. data/lib/cucumber/filters/prepare_world.rb +45 -0
  60. data/lib/cucumber/filters/quit.rb +28 -0
  61. data/lib/cucumber/filters/randomizer.rb +40 -0
  62. data/lib/cucumber/{runtime → filters}/tag_limits/test_case_index.rb +4 -2
  63. data/lib/cucumber/{runtime → filters}/tag_limits/verifier.rb +4 -2
  64. data/lib/cucumber/filters/tag_limits.rb +45 -0
  65. data/lib/cucumber/filters.rb +9 -0
  66. data/lib/cucumber/formatter/ansicolor.rb +0 -8
  67. data/lib/cucumber/formatter/console.rb +37 -20
  68. data/lib/cucumber/formatter/debug.rb +1 -8
  69. data/lib/cucumber/formatter/fanout.rb +27 -0
  70. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +10 -9
  71. data/lib/cucumber/formatter/html.rb +31 -6
  72. data/lib/cucumber/formatter/ignore_missing_messages.rb +20 -0
  73. data/lib/cucumber/formatter/junit.rb +97 -2
  74. data/lib/cucumber/formatter/legacy_api/adapter.rb +1060 -0
  75. data/lib/cucumber/formatter/legacy_api/ast.rb +376 -0
  76. data/lib/cucumber/formatter/legacy_api/results.rb +51 -0
  77. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +30 -0
  78. data/lib/cucumber/formatter/pretty.rb +14 -0
  79. data/lib/cucumber/formatter/progress.rb +10 -0
  80. data/lib/cucumber/formatter/rerun.rb +14 -88
  81. data/lib/cucumber/hooks.rb +97 -0
  82. data/lib/cucumber/language_support/language_methods.rb +0 -54
  83. data/lib/cucumber/multiline_argument/data_table.rb +41 -29
  84. data/lib/cucumber/platform.rb +3 -3
  85. data/lib/cucumber/project_initializer.rb +43 -0
  86. data/lib/cucumber/rb_support/rb_hook.rb +2 -2
  87. data/lib/cucumber/rb_support/rb_step_definition.rb +11 -2
  88. data/lib/cucumber/rb_support/rb_transform.rb +3 -1
  89. data/lib/cucumber/rb_support/rb_world.rb +2 -2
  90. data/lib/cucumber/rb_support/snippet.rb +1 -1
  91. data/lib/cucumber/rspec/doubles.rb +1 -1
  92. data/lib/cucumber/running_test_case.rb +115 -0
  93. data/lib/cucumber/runtime/after_hooks.rb +24 -0
  94. data/lib/cucumber/runtime/before_hooks.rb +23 -0
  95. data/lib/cucumber/runtime/for_programming_languages.rb +4 -8
  96. data/lib/cucumber/runtime/step_hooks.rb +22 -0
  97. data/lib/cucumber/runtime/support_code.rb +70 -5
  98. data/lib/cucumber/runtime.rb +56 -112
  99. data/lib/cucumber/step_match.rb +26 -2
  100. data/lib/cucumber.rb +7 -3
  101. data/spec/cucumber/cli/configuration_spec.rb +16 -1
  102. data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
  103. data/spec/cucumber/core_ext/instance_exec_spec.rb +4 -0
  104. data/spec/cucumber/file_specs_spec.rb +21 -2
  105. data/spec/cucumber/filters/activate_steps_spec.rb +57 -0
  106. data/spec/cucumber/{runtime → filters}/gated_receiver_spec.rb +3 -3
  107. data/spec/cucumber/{runtime → filters}/tag_limits/test_case_index_spec.rb +3 -3
  108. data/spec/cucumber/{runtime → filters}/tag_limits/verifier_spec.rb +4 -4
  109. data/spec/cucumber/{runtime/tag_limits/filter_spec.rb → filters/tag_limits_spec.rb} +6 -6
  110. data/spec/cucumber/formatter/debug_spec.rb +25 -530
  111. data/spec/cucumber/formatter/html_spec.rb +140 -0
  112. data/spec/cucumber/formatter/junit_spec.rb +212 -156
  113. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +2090 -0
  114. data/spec/cucumber/formatter/pretty_spec.rb +248 -2
  115. data/spec/cucumber/formatter/rerun_spec.rb +107 -0
  116. data/spec/cucumber/formatter/spec_helper.rb +17 -8
  117. data/spec/cucumber/hooks_spec.rb +30 -0
  118. data/spec/cucumber/multiline_argument/data_table_spec.rb +53 -47
  119. data/spec/cucumber/project_initializer_spec.rb +87 -0
  120. data/spec/cucumber/rb_support/rb_language_spec.rb +2 -2
  121. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +32 -7
  122. data/spec/cucumber/rb_support/rb_transform_spec.rb +20 -0
  123. data/spec/cucumber/rb_support/snippet_spec.rb +6 -6
  124. data/spec/cucumber/running_test_case_spec.rb +83 -0
  125. data/spec/cucumber/runtime_spec.rb +1 -5
  126. data/spec/spec_helper.rb +3 -4
  127. metadata +149 -107
  128. data/bin/cuke +0 -60
  129. data/features/docs/extending_cucumber/formatter_callbacks.feature +0 -370
  130. data/features/docs/output_from_hooks.feature +0 -128
  131. data/features/docs/report_called_undefined_steps.feature +0 -57
  132. data/features/docs/wire_protocol.feature +0 -337
  133. data/gem_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  134. data/gem_tasks/yard/default/layout/html/footer.erb +0 -5
  135. data/gem_tasks/yard/default/layout/html/index.erb +0 -1
  136. data/gem_tasks/yard/default/layout/html/layout.erb +0 -25
  137. data/gem_tasks/yard/default/layout/html/logo.erb +0 -1
  138. data/gem_tasks/yard/default/layout/html/setup.rb +0 -4
  139. data/gem_tasks/yard.rake +0 -43
  140. data/lib/cucumber/mappings.rb +0 -238
  141. data/lib/cucumber/reports/legacy_formatter.rb +0 -1349
  142. data/lib/cucumber/runtime/results.rb +0 -64
  143. data/lib/cucumber/runtime/tag_limits/filter.rb +0 -31
  144. data/lib/cucumber/runtime/tag_limits.rb +0 -15
  145. data/spec/cucumber/mappings_spec.rb +0 -180
  146. data/spec/cucumber/reports/legacy_formatter_spec.rb +0 -1860
  147. data/spec/cucumber/runtime/results_spec.rb +0 -88
@@ -10,8 +10,14 @@ Feature: Strict mode
10
10
  Scenario: Missing
11
11
  Given this step passes
12
12
  """
13
+ And a file named "features/pending.feature" with:
14
+ """
15
+ Feature: Pending
16
+ Scenario: Pending
17
+ Given this step is pending
18
+ """
13
19
 
14
- Scenario: Fail with --strict
20
+ Scenario: Fail with --strict due to undefined step
15
21
  When I run `cucumber -q features/missing.feature --strict`
16
22
  Then it should fail with:
17
23
  """
@@ -26,6 +32,23 @@ Feature: Strict mode
26
32
  1 step (1 undefined)
27
33
  """
28
34
 
35
+ Scenario: Fail with --strict due to pending step
36
+ Given the standard step definitions
37
+ When I run `cucumber -q features/pending.feature --strict`
38
+ Then it should fail with:
39
+ """
40
+ Feature: Pending
41
+
42
+ Scenario: Pending
43
+ Given this step is pending
44
+ TODO (Cucumber::Pending)
45
+ ./features/step_definitions/steps.rb:3:in `/^this step is pending$/'
46
+ features/pending.feature:3:in `Given this step is pending'
47
+
48
+ 1 scenario (1 pending)
49
+ 1 step (1 pending)
50
+ """
51
+
29
52
  Scenario: Succeed with --strict
30
53
  Given the standard step definitions
31
54
  When I run `cucumber -q features/missing.feature --strict`
@@ -127,3 +127,52 @@ Feature: Nested Steps
127
127
  1 scenario (1 failed)
128
128
  1 step (1 failed)
129
129
  """
130
+
131
+ Scenario: Undefined nested step
132
+ Given a file named "features/call_undefined_step_from_step_def.feature" with:
133
+ """
134
+ Feature: Calling undefined step
135
+
136
+ Scenario: Call directly
137
+ Given a step that calls an undefined step
138
+
139
+ Scenario: Call via another
140
+ Given a step that calls a step that calls an undefined step
141
+ """
142
+ And a file named "features/step_definitions/steps.rb" with:
143
+ """
144
+ Given /^a step that calls an undefined step$/ do
145
+ step 'this does not exist'
146
+ end
147
+
148
+ Given /^a step that calls a step that calls an undefined step$/ do
149
+ step 'a step that calls an undefined step'
150
+ end
151
+ """
152
+ When I run `cucumber -q features/call_undefined_step_from_step_def.feature`
153
+ Then it should fail with exactly:
154
+ """
155
+ Feature: Calling undefined step
156
+
157
+ Scenario: Call directly
158
+ Given a step that calls an undefined step
159
+ Undefined dynamic step: "this does not exist" (Cucumber::UndefinedDynamicStep)
160
+ ./features/step_definitions/steps.rb:2:in `/^a step that calls an undefined step$/'
161
+ features/call_undefined_step_from_step_def.feature:4:in `Given a step that calls an undefined step'
162
+
163
+ Scenario: Call via another
164
+ Given a step that calls a step that calls an undefined step
165
+ Undefined dynamic step: "this does not exist" (Cucumber::UndefinedDynamicStep)
166
+ ./features/step_definitions/steps.rb:2:in `/^a step that calls an undefined step$/'
167
+ ./features/step_definitions/steps.rb:6:in `/^a step that calls a step that calls an undefined step$/'
168
+ features/call_undefined_step_from_step_def.feature:7:in `Given a step that calls a step that calls an undefined step'
169
+
170
+ Failing Scenarios:
171
+ cucumber features/call_undefined_step_from_step_def.feature:3
172
+ cucumber features/call_undefined_step_from_step_def.feature:6
173
+
174
+ 2 scenarios (2 failed)
175
+ 2 steps (2 failed)
176
+ 0m0.012s
177
+
178
+ """
@@ -1,7 +1,6 @@
1
1
  Feature: Skip Scenario
2
- -
3
2
 
4
- Scenario: With a failing step
3
+ Scenario: With a passing step
5
4
  Given a file named "features/test.feature" with:
6
5
  """
7
6
  Feature: test
@@ -31,3 +30,33 @@ Feature: Skip Scenario
31
30
 
32
31
  """
33
32
 
33
+ Scenario: Use legacy API from a hook
34
+ Given a file named "features/test.feature" with:
35
+ """
36
+ Feature: test
37
+ Scenario: test
38
+ Given this step passes
39
+ And this step passes
40
+ """
41
+ And the standard step definitions
42
+ And a file named "features/support/hook.rb" with:
43
+ """
44
+ Before do |scenario|
45
+ scenario.skip_invoke!
46
+ end
47
+ """
48
+ When I run `cucumber -q`
49
+ Then it should pass with:
50
+ """
51
+ Feature: test
52
+
53
+ Scenario: test
54
+ Given this step passes
55
+ And this step passes
56
+
57
+ 1 scenario (1 skipped)
58
+ 2 steps (2 skipped)
59
+ 0m0.012s
60
+
61
+ """
62
+
@@ -13,6 +13,9 @@ Feature: Snippets
13
13
  \"\"\"
14
14
  example with <html> entities
15
15
  \"\"\"
16
+ When a simple when step
17
+ And another when step
18
+ Then a simple then step
16
19
  """
17
20
  When I run `cucumber features/undefined_steps.feature -s`
18
21
  Then the output should contain:
@@ -20,6 +23,18 @@ Feature: Snippets
20
23
  Given(/^a pystring$/) do |string|
21
24
  pending # Write code here that turns the phrase above into concrete actions
22
25
  end
26
+
27
+ When(/^a simple when step$/) do
28
+ pending # Write code here that turns the phrase above into concrete actions
29
+ end
30
+
31
+ When(/^another when step$/) do
32
+ pending # Write code here that turns the phrase above into concrete actions
33
+ end
34
+
35
+ Then(/^a simple then step$/) do
36
+ pending # Write code here that turns the phrase above into concrete actions
37
+ end
23
38
  """
24
39
 
25
40
  Scenario: Snippet for undefined step with a step table
@@ -94,7 +94,7 @@ Feature: Exception in AfterStep Block
94
94
  Given this step passes # features/step_definitions/steps.rb:1
95
95
 
96
96
  Failing Scenarios:
97
- cucumber features/naughty_step_in_scenario_outline.feature:9 # Scenario Outline: Naughty Step, Examples (row 2)
97
+ cucumber features/naughty_step_in_scenario_outline.feature:9 # Scenario Outline: Naughty Step, Examples (#2)
98
98
 
99
99
  4 scenarios (1 failed, 3 passed)
100
100
  4 steps (4 passed)
@@ -0,0 +1,80 @@
1
+ Feature: Exceptions in Around Hooks
2
+
3
+ Around hooks are awkward beasts to handle internally.
4
+
5
+ Right now, if there's an error in your Around hook before you call `block.call`,
6
+ we won't even print the steps for the scenario.
7
+
8
+ This is because that `block.call` invokes all the logic that would tell Cucumber's
9
+ UI about the steps in your scenario. If we never reach that code, we'll never be
10
+ told about them.
11
+
12
+ There's another scenario to consider, where the exception occurs after the steps
13
+ have been run. How would we want to report in that case?
14
+
15
+ Scenario: Exception before the test case is run
16
+ Given the standard step definitions
17
+ And a file named "features/support/env.rb" with:
18
+ """
19
+ Around do |scenario, block|
20
+ fail "this should be reported"
21
+ block.call
22
+ end
23
+ """
24
+ And a file named "features/test.feature" with:
25
+ """
26
+ Feature:
27
+ Scenario:
28
+ Given this step passes
29
+ """
30
+ When I run `cucumber -q`
31
+ Then it should fail with exactly:
32
+ """
33
+ Feature:
34
+
35
+ Scenario:
36
+ this should be reported (RuntimeError)
37
+ ./features/support/env.rb:2:in `Around'
38
+
39
+ Failing Scenarios:
40
+ cucumber features/test.feature:2
41
+
42
+ 1 scenario (1 failed)
43
+ 0 steps
44
+ 0m0.012s
45
+
46
+ """
47
+
48
+ Scenario: Exception after the test case is run
49
+ Given the standard step definitions
50
+ And a file named "features/support/env.rb" with:
51
+ """
52
+ Around do |scenario, block|
53
+ block.call
54
+ fail "this should be reported"
55
+ end
56
+ """
57
+ And a file named "features/test.feature" with:
58
+ """
59
+ Feature:
60
+ Scenario:
61
+ Given this step passes
62
+ """
63
+ When I run `cucumber -q`
64
+ Then it should fail with exactly:
65
+ """
66
+ Feature:
67
+
68
+ Scenario:
69
+ Given this step passes
70
+ this should be reported (RuntimeError)
71
+ ./features/support/env.rb:3:in `Around'
72
+
73
+ Failing Scenarios:
74
+ cucumber features/test.feature:2
75
+
76
+ 1 scenario (1 failed)
77
+ 1 step (1 passed)
78
+ 0m0.012s
79
+
80
+ """
@@ -0,0 +1,29 @@
1
+ Feature: Custom filter
2
+
3
+ Scenario: Add a custom filter via AfterConfiguration hook
4
+ Given a file named "features/test.feature" with:
5
+ """
6
+ Feature:
7
+ Scenario:
8
+ Given my special step
9
+ """
10
+ And a file named "features/support/my_filter.rb" with:
11
+ """
12
+ require 'cucumber/core/filter'
13
+
14
+ MakeAnythingPass = Cucumber::Core::Filter.new do
15
+ def test_case(test_case)
16
+ activated_steps = test_case.test_steps.map do |test_step|
17
+ test_step.with_action { }
18
+ end
19
+ test_case.with_steps(activated_steps).describe_to receiver
20
+ end
21
+ end
22
+
23
+ AfterConfiguration do |config|
24
+ config.filters << MakeAnythingPass.new
25
+ end
26
+ """
27
+ When I run `cucumber --strict`
28
+ Then it should pass
29
+
@@ -1,18 +1,45 @@
1
1
  Feature: Custom Formatter
2
2
 
3
- Scenario: my own formatter
3
+ Background:
4
4
  Given a file named "features/f.feature" with:
5
5
  """
6
6
  Feature: I'll use my own
7
- because I'm worth it
8
- Scenario: just print me
7
+ Scenario: Just print me
9
8
  Given this step passes
10
9
  """
11
10
  And the standard step definitions
12
- And a file named "features/support/ze/formator.rb" with:
11
+
12
+ Scenario: Use the new API
13
+ Given a file named "features/support/custom_formatter.rb" with:
13
14
  """
14
- module Ze
15
- class Formator
15
+ module MyCustom
16
+ class Formatter
17
+ def initialize(runtime, io, options)
18
+ @io = io
19
+ end
20
+
21
+ def before_test_case(test_case)
22
+ feature = test_case.source.first
23
+ scenario = test_case.source.last
24
+ @io.puts feature.short_name.upcase
25
+ @io.puts " #{scenario.name.upcase}"
26
+ end
27
+ end
28
+ end
29
+ """
30
+ When I run `cucumber features/f.feature --format MyCustom::Formatter`
31
+ Then it should pass with exactly:
32
+ """
33
+ I'LL USE MY OWN
34
+ JUST PRINT ME
35
+
36
+ """
37
+
38
+ Scenario: Use the legacy API
39
+ Given a file named "features/support/custom_legacy_formatter.rb" with:
40
+ """
41
+ module MyCustom
42
+ class LegacyFormatter
16
43
  def initialize(runtime, io, options)
17
44
  @io = io
18
45
  end
@@ -27,7 +54,38 @@ Feature: Custom Formatter
27
54
  end
28
55
  end
29
56
  """
30
- When I run `cucumber features/f.feature --format Ze::Formator`
57
+ When I run `cucumber features/f.feature --format MyCustom::LegacyFormatter`
58
+ Then it should pass with exactly:
59
+ """
60
+ I'LL USE MY OWN
61
+ JUST PRINT ME
62
+
63
+ """
64
+
65
+ Scenario: Use both
66
+ You can use a specific shim to opt-in to both APIs at once.
67
+
68
+ Given a file named "features/support/custom_mixed_formatter.rb" with:
69
+ """
70
+ module MyCustom
71
+ class MixedFormatter
72
+
73
+ def initialize(runtime, io, options)
74
+ @io = io
75
+ end
76
+
77
+ def before_test_case(test_case)
78
+ feature = test_case.source.first
79
+ @io.puts feature.short_name.upcase
80
+ end
81
+
82
+ def scenario_name(keyword, name, file_colon_line, source_indent)
83
+ @io.puts " #{name.upcase}"
84
+ end
85
+ end
86
+ end
87
+ """
88
+ When I run `cucumber features/f.feature --format MyCustom::MixedFormatter`
31
89
  Then it should pass with exactly:
32
90
  """
33
91
  I'LL USE MY OWN
@@ -18,23 +18,30 @@ Feature: Debug formatter
18
18
  Then the stderr should not contain anything
19
19
  Then it should pass with:
20
20
  """
21
+ before_test_case
21
22
  before_features
22
- before_feature
23
- before_tags
24
- after_tags
25
- feature_name
26
- before_feature_element
27
- before_tags
28
- after_tags
29
- scenario_name
30
- before_steps
31
- before_step
32
- before_step_result
33
- step_name
34
- after_step_result
35
- after_step
36
- after_steps
37
- after_feature_element
38
- after_feature
23
+ before_feature
24
+ before_tags
25
+ after_tags
26
+ feature_name
27
+ before_test_step
28
+ after_test_step
29
+ before_test_step
30
+ before_feature_element
31
+ before_tags
32
+ after_tags
33
+ scenario_name
34
+ before_steps
35
+ before_step
36
+ before_step_result
37
+ step_name
38
+ after_step_result
39
+ after_step
40
+ after_test_step
41
+ after_steps
42
+ after_feature_element
43
+ after_test_case
44
+ after_feature
39
45
  after_features
46
+ done
40
47
  """
@@ -82,6 +82,14 @@ Feature: JSON output formatter
82
82
  Scenario:
83
83
  Given I embed data directly
84
84
 
85
+ Scenario Outline:
86
+ Given I embed data directly
87
+
88
+ Examples:
89
+ | dummy |
90
+ | 1 |
91
+ | 2 |
92
+
85
93
  """
86
94
  And a file named "features/out_scenario_out_scenario_outline.feature" with:
87
95
  """
@@ -613,7 +621,7 @@ Feature: JSON output formatter
613
621
 
614
622
  @spawn
615
623
  Scenario: embedding data directly
616
- When I run `cucumber -b --format json features/embed_data_directly.feature`
624
+ When I run `cucumber -b --format json -x features/embed_data_directly.feature`
617
625
  Then it should pass with JSON:
618
626
  """
619
627
  [
@@ -652,6 +660,62 @@ Feature: JSON output formatter
652
660
  }
653
661
  }
654
662
  ]
663
+ },
664
+ {
665
+ "keyword": "Scenario Outline",
666
+ "name": "",
667
+ "line": 11,
668
+ "description": "",
669
+ "id": "an-embed-data-directly-feature;;;2",
670
+ "type": "scenario",
671
+ "steps": [
672
+ {
673
+ "keyword": "Given ",
674
+ "name": "I embed data directly",
675
+ "line": 11,
676
+ "embeddings": [
677
+ {
678
+ "mime_type": "mime-type",
679
+ "data": "YWJj"
680
+ }
681
+ ],
682
+ "match": {
683
+ "location": "features/step_definitions/json_steps.rb:10"
684
+ },
685
+ "result": {
686
+ "status": "passed",
687
+ "duration": 1
688
+ }
689
+ }
690
+ ]
691
+ },
692
+ {
693
+ "keyword": "Scenario Outline",
694
+ "name": "",
695
+ "line": 12,
696
+ "description": "",
697
+ "id": "an-embed-data-directly-feature;;;3",
698
+ "type": "scenario",
699
+ "steps": [
700
+ {
701
+ "keyword": "Given ",
702
+ "name": "I embed data directly",
703
+ "line": 12,
704
+ "embeddings": [
705
+ {
706
+ "mime_type": "mime-type",
707
+ "data": "YWJj"
708
+ }
709
+ ],
710
+ "match": {
711
+ "location": "features/step_definitions/json_steps.rb:10"
712
+ },
713
+ "result": {
714
+ "status": "passed",
715
+ "duration": 1
716
+ }
717
+ }
718
+ ]
655
719
  }
656
720
  ]
657
721
  }
@@ -274,3 +274,43 @@ You *must* specify --out DIR for the junit formatter
274
274
  </testsuite>
275
275
 
276
276
  """
277
+
278
+ Scenario: one feature, one scenario outline, two examples: one passing, one failing with --expand option
279
+ When I run `cucumber --expand --format junit --out tmp/ features/scenario_outline.feature`
280
+ Then it should fail with exactly:
281
+ """
282
+
283
+ """
284
+ And the junit output file "tmp/TEST-features-scenario_outline.xml" should contain:
285
+ """
286
+ <?xml version="1.0" encoding="UTF-8"?>
287
+ <testsuite failures="1" errors="0" skipped="0" tests="2" time="0.05" name="Scenario outlines">
288
+ <testcase classname="Scenario outlines" name="Using scenario outlines (outline example : | passes |)" time="0.05">
289
+ <system-out/>
290
+ <system-err/>
291
+ </testcase>
292
+ <testcase classname="Scenario outlines" name="Using scenario outlines (outline example : | fails |)" time="0.05">
293
+ <failure message="failed Using scenario outlines (outline example : | fails |)" type="failed">
294
+ <![CDATA[Scenario Outline: Using scenario outlines
295
+
296
+ Example row: | fails |
297
+
298
+ Message:
299
+ ]]>
300
+ <![CDATA[ (RuntimeError)
301
+ ./features/step_definitions/steps.rb:4:in `/^this step fails$/'
302
+ features/scenario_outline.feature:9:in `Given this step fails'
303
+ features/scenario_outline.feature:4:in `Given this step <type>']]>
304
+ </failure>
305
+ <system-out/>
306
+ <system-err/>
307
+ </testcase>
308
+ <system-out>
309
+ <![CDATA[]]>
310
+ </system-out>
311
+ <system-err>
312
+ <![CDATA[]]>
313
+ </system-err>
314
+ </testsuite>
315
+
316
+ """
@@ -28,4 +28,46 @@ Feature: Pretty output formatter
28
28
  """
29
29
  Using the default profile...
30
30
  """
31
+ Scenario: Hook output should be printed before hook exception
32
+ Given the standard step definitions
33
+ And a file named "features/test.feature" with:
34
+ """
35
+ Feature:
36
+ Scenario:
37
+ Given this step passes
38
+ """
39
+ And a file named "features/step_definitions/output_steps.rb" with:
40
+ """
41
+ Before do
42
+ puts "Before hook"
43
+ end
31
44
 
45
+ AfterStep do
46
+ puts "AfterStep hook"
47
+ end
48
+
49
+ After do
50
+ puts "After hook"
51
+ raise "error"
52
+ end
53
+ """
54
+ When I run `cucumber -q -f pretty features/test.feature`
55
+ Then the stderr should not contain anything
56
+ Then it should fail with:
57
+ """
58
+ Feature:
59
+
60
+ Scenario:
61
+ Before hook
62
+ Given this step passes
63
+ AfterStep hook
64
+ After hook
65
+ error (RuntimeError)
66
+ ./features/step_definitions/output_steps.rb:11:in `After'
67
+
68
+ Failing Scenarios:
69
+ cucumber features/test.feature:2
70
+
71
+ 1 scenario (1 failed)
72
+ 1 step (1 passed)
73
+ """
@@ -113,8 +113,9 @@ Feature: Rerun formatter
113
113
  features/failing_background_outline.feature:11:12
114
114
  """
115
115
 
116
- Scenario: Scenario outlines with expand
117
- For details see https://github.com/cucumber/cucumber/issues/503
116
+ Scenario: Scenario outlines with expand
117
+ For details see https://github.com/cucumber/cucumber/issues/503
118
+
118
119
  Given a file named "features/one_passing_one_failing.feature" with:
119
120
  """
120
121
  Feature: One passing example, one failing example
@@ -9,7 +9,7 @@ Feature: Getting started
9
9
  When I run `cucumber`
10
10
  Then it should fail with:
11
11
  """
12
- No such file or directory - features. Please create a features directory to get started.
12
+ No such file or directory - features. You can use `cucumber --init` to get started.
13
13
  """
14
14
 
15
15
  Scenario: Accidentally run Cucumber in a folder with Ruby files in it.
@@ -1,6 +1,6 @@
1
1
  @wire
2
- Feature: Wire Protocol with ERB
3
- In order to be allow Cucumber to touch my app in intimate places
2
+ Feature: ERB configuration
3
+
4
4
  As a developer on server with multiple users
5
5
  I want to be able to configure which port my wire server runs on
6
6
  So that I can avoid port conflicts
@@ -0,0 +1,30 @@
1
+ @wire
2
+ Feature: Handle unexpected response
3
+
4
+ When the server sends us back a message we don't understand, this is how Cucumber will behave.
5
+
6
+ Background:
7
+ Given a file named "features/wired.feature" with:
8
+ """
9
+ Feature: High strung
10
+ Scenario: Wired
11
+ Given we're all wired
12
+
13
+ """
14
+ And a file named "features/step_definitions/some_remote_place.wire" with:
15
+ """
16
+ host: localhost
17
+ port: 54321
18
+
19
+ """
20
+
21
+ Scenario: Unexpected response
22
+ Given there is a wire server running on port 54321 which understands the following protocol:
23
+ | request | response |
24
+ | ["begin_scenario"] | ["yikes"] |
25
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
26
+ When I run `cucumber -f pretty`
27
+ Then the output should contain:
28
+ """
29
+ undefined method `handle_yikes'
30
+ """