cucumber 2.99.0 → 3.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +22 -10
  3. data/CONTRIBUTING.md +13 -0
  4. data/Gemfile +11 -4
  5. data/History.md +19 -1
  6. data/README.md +1 -1
  7. data/cucumber.gemspec +2 -2
  8. data/cucumber.yml +2 -2
  9. data/features/docs/api/listen_for_events.feature +7 -6
  10. data/features/docs/cli/help.feature +8 -0
  11. data/features/docs/cli/retry_failing_tests.feature +51 -16
  12. data/features/docs/defining_steps/nested_steps_i18n.feature +2 -0
  13. data/features/docs/defining_steps/printing_messages.feature +0 -1
  14. data/features/docs/defining_steps/skip_scenario.feature +0 -34
  15. data/features/docs/extending_cucumber/custom_formatter.feature +2 -30
  16. data/features/docs/formatters/summary_formatter.feature +34 -0
  17. data/features/docs/gherkin/unicode_table.feature +1 -1
  18. data/features/docs/post_configuration_hook.feature +0 -16
  19. data/features/docs/writing_support_code/world.feature +129 -0
  20. data/features/lib/step_definitions/aruba_steps.rb +1 -0
  21. data/features/lib/step_definitions/cli_steps.rb +4 -0
  22. data/features/lib/step_definitions/cucumber_steps.rb +1 -0
  23. data/features/lib/step_definitions/iso-8859-1_steps.rb +1 -0
  24. data/features/lib/step_definitions/json_steps.rb +1 -0
  25. data/features/lib/step_definitions/junit_steps.rb +1 -0
  26. data/features/lib/step_definitions/language_steps.rb +1 -0
  27. data/features/lib/step_definitions/profile_steps.rb +1 -0
  28. data/features/lib/step_definitions/retry_steps.rb +32 -12
  29. data/features/lib/step_definitions/ruby_steps.rb +1 -0
  30. data/features/lib/step_definitions/wire_steps.rb +1 -0
  31. data/features/lib/support/env.rb +2 -1
  32. data/features/lib/support/fake_wire_server.rb +1 -0
  33. data/features/lib/support/feature_factory.rb +1 -0
  34. data/features/lib/support/normalise_output.rb +1 -0
  35. data/gem_tasks/contributors.rake +1 -0
  36. data/gem_tasks/cov.rake +1 -0
  37. data/gem_tasks/cucumber.rake +1 -0
  38. data/gem_tasks/downloads.rb +1 -0
  39. data/gem_tasks/environment.rake +1 -0
  40. data/gem_tasks/examples.rake +2 -1
  41. data/gem_tasks/fix_cr_lf.rake +2 -1
  42. data/gem_tasks/flog.rake +2 -1
  43. data/gem_tasks/rspec.rake +1 -0
  44. data/gem_tasks/sass.rake +2 -1
  45. data/lib/autotest/cucumber.rb +1 -0
  46. data/lib/autotest/cucumber_mixin.rb +1 -0
  47. data/lib/autotest/cucumber_rails.rb +1 -0
  48. data/lib/autotest/cucumber_rails_rspec.rb +1 -0
  49. data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
  50. data/lib/autotest/cucumber_rspec.rb +1 -0
  51. data/lib/autotest/cucumber_rspec2.rb +1 -0
  52. data/lib/autotest/discover.rb +1 -0
  53. data/lib/cucumber.rb +1 -13
  54. data/lib/cucumber/cli/configuration.rb +3 -6
  55. data/lib/cucumber/cli/main.rb +2 -1
  56. data/lib/cucumber/cli/options.rb +239 -173
  57. data/lib/cucumber/cli/profile_loader.rb +1 -0
  58. data/lib/cucumber/cli/rerun_file.rb +1 -0
  59. data/lib/cucumber/configuration.rb +40 -19
  60. data/lib/cucumber/constantize.rb +1 -0
  61. data/lib/cucumber/core_ext/instance_exec.rb +1 -0
  62. data/lib/cucumber/core_ext/string.rb +1 -0
  63. data/lib/cucumber/deprecate.rb +1 -0
  64. data/lib/cucumber/encoding.rb +1 -0
  65. data/lib/cucumber/errors.rb +3 -1
  66. data/lib/cucumber/events.rb +13 -3
  67. data/lib/cucumber/events/step_definition_registered.rb +24 -0
  68. data/lib/cucumber/events/step_match.rb +4 -1
  69. data/lib/cucumber/events/test_run_finished.rb +12 -0
  70. data/lib/cucumber/file_specs.rb +1 -0
  71. data/lib/cucumber/filters.rb +2 -0
  72. data/lib/cucumber/filters/activate_steps.rb +2 -1
  73. data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
  74. data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
  75. data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
  76. data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
  77. data/lib/cucumber/filters/gated_receiver.rb +1 -0
  78. data/lib/cucumber/filters/prepare_world.rb +1 -0
  79. data/lib/cucumber/filters/quit.rb +1 -0
  80. data/lib/cucumber/filters/randomizer.rb +1 -0
  81. data/lib/cucumber/filters/retry.rb +3 -3
  82. data/lib/cucumber/filters/tag_limits.rb +1 -0
  83. data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
  84. data/lib/cucumber/filters/tag_limits/verifier.rb +1 -0
  85. data/lib/cucumber/formatter/ansicolor.rb +1 -0
  86. data/lib/cucumber/formatter/backtrace_filter.rb +3 -2
  87. data/lib/cucumber/formatter/console.rb +61 -52
  88. data/lib/cucumber/formatter/console_counts.rb +57 -0
  89. data/lib/cucumber/formatter/console_issues.rb +37 -0
  90. data/lib/cucumber/formatter/debug.rb +1 -0
  91. data/lib/cucumber/formatter/duration.rb +1 -0
  92. data/lib/cucumber/formatter/duration_extractor.rb +1 -0
  93. data/lib/cucumber/formatter/fail_fast.rb +4 -2
  94. data/lib/cucumber/formatter/fanout.rb +1 -0
  95. data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
  96. data/lib/cucumber/formatter/html.rb +6 -5
  97. data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
  98. data/lib/cucumber/formatter/interceptor.rb +1 -0
  99. data/lib/cucumber/formatter/io.rb +1 -0
  100. data/lib/cucumber/formatter/json.rb +15 -13
  101. data/lib/cucumber/formatter/json_pretty.rb +1 -0
  102. data/lib/cucumber/formatter/junit.rb +13 -11
  103. data/lib/cucumber/formatter/legacy_api/adapter.rb +28 -32
  104. data/lib/cucumber/formatter/legacy_api/ast.rb +1 -0
  105. data/lib/cucumber/formatter/legacy_api/results.rb +1 -0
  106. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
  107. data/lib/cucumber/formatter/pretty.rb +7 -1
  108. data/lib/cucumber/formatter/progress.rb +56 -13
  109. data/lib/cucumber/formatter/rerun.rb +15 -18
  110. data/lib/cucumber/formatter/stepdefs.rb +1 -0
  111. data/lib/cucumber/formatter/steps.rb +1 -0
  112. data/lib/cucumber/formatter/summary.rb +43 -20
  113. data/lib/cucumber/formatter/unicode.rb +1 -0
  114. data/lib/cucumber/formatter/usage.rb +26 -21
  115. data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
  116. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +1 -0
  117. data/lib/cucumber/gherkin/formatter/escaping.rb +1 -0
  118. data/lib/cucumber/gherkin/i18n.rb +1 -0
  119. data/lib/cucumber/gherkin/steps_parser.rb +1 -0
  120. data/lib/cucumber/hooks.rb +1 -0
  121. data/lib/cucumber/load_path.rb +1 -0
  122. data/lib/cucumber/multiline_argument.rb +1 -2
  123. data/lib/cucumber/multiline_argument/data_table.rb +3 -1
  124. data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
  125. data/lib/cucumber/platform.rb +1 -0
  126. data/lib/cucumber/project_initializer.rb +2 -1
  127. data/lib/cucumber/rake/task.rb +1 -0
  128. data/lib/cucumber/rb_support/rb_dsl.rb +11 -9
  129. data/lib/cucumber/rb_support/rb_hook.rb +1 -0
  130. data/lib/cucumber/rb_support/rb_language.rb +19 -8
  131. data/lib/cucumber/rb_support/rb_step_definition.rb +1 -0
  132. data/lib/cucumber/rb_support/rb_transform.rb +1 -0
  133. data/lib/cucumber/rb_support/rb_world.rb +42 -20
  134. data/lib/cucumber/rb_support/snippet.rb +2 -1
  135. data/lib/cucumber/rspec/disable_option_parser.rb +1 -0
  136. data/lib/cucumber/rspec/doubles.rb +1 -0
  137. data/lib/cucumber/running_test_case.rb +1 -25
  138. data/lib/cucumber/runtime.rb +15 -10
  139. data/lib/cucumber/runtime/after_hooks.rb +1 -0
  140. data/lib/cucumber/runtime/before_hooks.rb +1 -0
  141. data/lib/cucumber/runtime/for_programming_languages.rb +1 -0
  142. data/lib/cucumber/runtime/step_hooks.rb +1 -0
  143. data/lib/cucumber/runtime/support_code.rb +1 -0
  144. data/lib/cucumber/runtime/user_interface.rb +1 -0
  145. data/lib/cucumber/step_argument.rb +1 -0
  146. data/lib/cucumber/step_definition_light.rb +1 -0
  147. data/lib/cucumber/step_definitions.rb +1 -0
  148. data/lib/cucumber/step_match.rb +1 -0
  149. data/lib/cucumber/step_match_search.rb +1 -0
  150. data/lib/cucumber/term/ansicolor.rb +1 -0
  151. data/lib/cucumber/unit.rb +1 -0
  152. data/lib/cucumber/version +1 -1
  153. data/lib/simplecov_setup.rb +1 -0
  154. data/spec/cucumber/cli/configuration_spec.rb +1 -0
  155. data/spec/cucumber/cli/main_spec.rb +1 -0
  156. data/spec/cucumber/cli/options_spec.rb +1 -0
  157. data/spec/cucumber/cli/profile_loader_spec.rb +1 -0
  158. data/spec/cucumber/cli/rerun_spec.rb +1 -0
  159. data/spec/cucumber/configuration_spec.rb +1 -0
  160. data/spec/cucumber/constantize_spec.rb +1 -0
  161. data/spec/cucumber/core_ext/instance_exec_spec.rb +1 -0
  162. data/spec/cucumber/file_specs_spec.rb +1 -0
  163. data/spec/cucumber/filters/activate_steps_spec.rb +9 -6
  164. data/spec/cucumber/filters/gated_receiver_spec.rb +1 -0
  165. data/spec/cucumber/filters/retry_spec.rb +27 -21
  166. data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +1 -0
  167. data/spec/cucumber/filters/tag_limits/verifier_spec.rb +1 -0
  168. data/spec/cucumber/filters/tag_limits_spec.rb +1 -0
  169. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -0
  170. data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
  171. data/spec/cucumber/formatter/debug_spec.rb +1 -0
  172. data/spec/cucumber/formatter/duration_spec.rb +1 -0
  173. data/spec/cucumber/formatter/fail_fast_spec.rb +5 -5
  174. data/spec/cucumber/formatter/html_spec.rb +6 -1
  175. data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
  176. data/spec/cucumber/formatter/json_spec.rb +29 -28
  177. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  178. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +8 -3
  179. data/spec/cucumber/formatter/pretty_spec.rb +1 -0
  180. data/spec/cucumber/formatter/progress_spec.rb +2 -1
  181. data/spec/cucumber/formatter/rerun_spec.rb +70 -64
  182. data/spec/cucumber/formatter/spec_helper.rb +8 -7
  183. data/spec/cucumber/hooks_spec.rb +1 -0
  184. data/spec/cucumber/multiline_argument/data_table_spec.rb +1 -0
  185. data/spec/cucumber/project_initializer_spec.rb +2 -1
  186. data/spec/cucumber/rake/forked_spec.rb +1 -0
  187. data/spec/cucumber/rake/task_spec.rb +1 -0
  188. data/spec/cucumber/rb_support/rb_language_spec.rb +81 -3
  189. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +1 -0
  190. data/spec/cucumber/rb_support/rb_transform_spec.rb +1 -0
  191. data/spec/cucumber/rb_support/rb_world_spec.rb +2 -1
  192. data/spec/cucumber/rb_support/snippet_spec.rb +1 -0
  193. data/spec/cucumber/running_test_case_spec.rb +1 -0
  194. data/spec/cucumber/runtime/for_programming_languages_spec.rb +1 -0
  195. data/spec/cucumber/runtime/support_code_spec.rb +1 -0
  196. data/spec/cucumber/runtime_spec.rb +1 -0
  197. data/spec/cucumber/step_argument_spec.rb +1 -0
  198. data/spec/cucumber/step_match_search_spec.rb +1 -0
  199. data/spec/cucumber/step_match_spec.rb +1 -0
  200. data/spec/cucumber/world/pending_spec.rb +1 -0
  201. data/spec/spec_helper.rb +1 -0
  202. data/spec/support/standard_step_actions.rb +1 -0
  203. metadata +24 -23
  204. data/lib/cucumber/ast.rb +0 -13
  205. data/lib/cucumber/events/after_test_case.rb +0 -25
  206. data/lib/cucumber/events/after_test_step.rb +0 -30
  207. data/lib/cucumber/events/before_test_case.rb +0 -18
  208. data/lib/cucumber/events/before_test_step.rb +0 -23
  209. data/lib/cucumber/events/bus.rb +0 -86
  210. data/lib/cucumber/events/finished_testing.rb +0 -9
  211. data/lib/cucumber/formatter/event_bus_report.rb +0 -38
  212. data/spec/cucumber/events/bus_spec.rb +0 -94
  213. data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
  214. data/spec/cucumber_spec.rb +0 -39
@@ -1,9 +0,0 @@
1
- module Cucumber
2
- module Events
3
-
4
- # Event fired after aall test cases have finished executing
5
- class FinishedTesting
6
- end
7
-
8
- end
9
- end
@@ -1,38 +0,0 @@
1
- module Cucumber
2
- module Formatter
3
-
4
- # Adapter between Cucumber::Core::Test::Runner's Report API and
5
- # Cucumber's event bus
6
- class EventBusReport
7
- attr_reader :config
8
- private :config
9
-
10
- def initialize(config)
11
- @config = config
12
- end
13
-
14
- def before_test_case(test_case)
15
- @config.notify Events::BeforeTestCase.new(test_case)
16
- @test_case = test_case
17
- end
18
-
19
- def before_test_step(test_step)
20
- @config.notify Events::BeforeTestStep.new(@test_case, test_step)
21
- end
22
-
23
- def after_test_step(test_step, result)
24
- @config.notify Events::AfterTestStep.new(@test_case, test_step, result)
25
- end
26
-
27
- def after_test_case(test_case, result)
28
- @config.notify Events::AfterTestCase.new(test_case, result)
29
- end
30
-
31
- def done
32
- @config.notify Events::FinishedTesting.new
33
- end
34
- end
35
-
36
- end
37
- end
38
-
@@ -1,94 +0,0 @@
1
- require "cucumber/events/bus"
2
-
3
- module Cucumber
4
- module Events
5
- class TestEvent
6
- end
7
-
8
- class AnotherTestEvent
9
- end
10
-
11
- describe Bus do
12
- let(:bus) { Bus.new(Cucumber::Events) }
13
- let(:test_event) { TestEvent.new }
14
- let(:another_test_event) { AnotherTestEvent.new }
15
-
16
- it "calls subscriber with event payload" do
17
- received_payload = nil
18
- bus.register(TestEvent) do |event|
19
- received_payload = event
20
- end
21
-
22
- bus.notify test_event
23
-
24
- expect(received_payload).to eq(test_event)
25
- end
26
-
27
- it "does not call subscribers for other events" do
28
- handler_called = false
29
- bus.register(TestEvent) do |event|
30
- handler_called = true
31
- end
32
-
33
- bus.notify another_test_event
34
-
35
- expect(handler_called).to eq(false)
36
- end
37
-
38
- it "broadcasts to multiple subscribers" do
39
- received_events = []
40
- bus.register(TestEvent) do |event|
41
- received_events << event
42
- end
43
- bus.register(TestEvent) do |event|
44
- received_events << event
45
- end
46
-
47
- bus.notify test_event
48
-
49
- expect(received_events.length).to eq 2
50
- expect(received_events).to all eq test_event
51
- end
52
-
53
- it "allows subscription by string" do
54
- received_payload = nil
55
- bus.register('Cucumber::Events::TestEvent') do |event|
56
- received_payload = event
57
- end
58
-
59
- bus.notify test_event
60
-
61
- expect(received_payload).to eq(test_event)
62
- end
63
-
64
- it "allows subscription by symbol (for events in the Cucumber::Events namespace)" do
65
- received_payload = nil
66
- bus.register(:test_event) do |event|
67
- received_payload = event
68
- end
69
-
70
- bus.notify test_event
71
-
72
- expect(received_payload).to eq(test_event)
73
- end
74
-
75
- it "allows handlers that are objects with a `call` method" do
76
- class MyHandler
77
- attr_reader :received_payload
78
-
79
- def call(event)
80
- @received_payload = event
81
- end
82
- end
83
-
84
- handler = MyHandler.new
85
- bus.register(TestEvent, handler)
86
-
87
- bus.notify test_event
88
-
89
- expect(handler.received_payload).to eq test_event
90
- end
91
-
92
- end
93
- end
94
- end
@@ -1,88 +0,0 @@
1
- require 'cucumber/configuration'
2
- require 'cucumber/runtime'
3
- require 'cucumber/formatter/spec_helper'
4
- require 'cucumber/formatter/event_bus_report'
5
-
6
- module Cucumber
7
- module Formatter
8
- describe EventBusReport do
9
- extend SpecHelperDsl
10
- include SpecHelper
11
-
12
- context "With no options" do
13
- let(:config) { Cucumber::Configuration.new }
14
-
15
- before(:each) do
16
- @formatter = EventBusReport.new(config)
17
- end
18
-
19
- describe "given a single feature" do
20
-
21
- describe "a scenario with a single passing step" do
22
- define_feature <<-FEATURE
23
- Feature:
24
- Scenario: Test Scenario
25
- Given passing
26
- FEATURE
27
-
28
- define_steps do
29
- Given(/pass/) {}
30
- end
31
-
32
- it "emits a BeforeTestCase event" do
33
- received_event = nil
34
- config.on_event Cucumber::Events::BeforeTestCase do |event|
35
- received_event = event
36
- end
37
- run_defined_feature
38
- expect(received_event.test_case.name).to eq "Test Scenario"
39
- end
40
-
41
- it "emits a BeforeTestStep event" do
42
- received_event = nil
43
- config.on_event Cucumber::Events::BeforeTestStep do |event|
44
- received_event = event
45
- end
46
- run_defined_feature
47
- expect(received_event.test_case.name).to eq "Test Scenario"
48
- expect(received_event.test_step.name).to eq "passing"
49
- end
50
-
51
- it "emits an AfterTestStep event with a passed result" do
52
- received_event = nil
53
- config.on_event Cucumber::Events::AfterTestStep do |event|
54
- received_event = event
55
- end
56
- run_defined_feature
57
- expect(received_event.test_case.name).to eq "Test Scenario"
58
- expect(received_event.test_step.name).to eq "passing"
59
- expect(received_event.result).to be_passed
60
- end
61
-
62
- it "emits an AfterTestCase event with a passed result" do
63
- received_event = nil
64
- config.on_event Cucumber::Events::AfterTestCase do |event|
65
- received_event = event
66
- end
67
- run_defined_feature
68
- expect(received_event.test_case.name).to eq "Test Scenario"
69
- expect(received_event.result).to be_passed
70
- end
71
-
72
- it "emits a Done event when the test run is finished" do
73
- received_event = nil
74
- config.on_event Cucumber::Events::FinishedTesting do |event|
75
- received_event = event
76
- end
77
- run_defined_feature
78
- expect(received_event).not_to be_nil
79
- end
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end
86
-
87
-
88
-
@@ -1,39 +0,0 @@
1
- require 'cucumber'
2
-
3
- describe Cucumber do
4
-
5
- # Implementation is backported from ruby 2.0 when cucumber is used on ruby 1.9.
6
- # The tests will run on all implementations to ensure we have the same
7
- # feature set.
8
- describe 'Hash' do
9
- it "converts nil to empty {}" do
10
- expect(Cucumber::Hash(nil)).to eq({})
11
- end
12
-
13
- it "converts [] to {}" do
14
- expect(Cucumber::Hash([])).to eq({})
15
- end
16
-
17
- it "converts a hash to an equivalent hash" do
18
- original = {:a => 1, :b => 2}
19
- expect(Cucumber::Hash(original)).to eq({a: 1, b: 2})
20
- end
21
-
22
- it "converts an object with a to_hash method" do
23
- original = Object.new
24
- def original.to_hash
25
- {key: "value"}
26
- end
27
-
28
- expect(Cucumber::Hash(original)).to eq({key: "value"})
29
- end
30
-
31
- it "raises a TypeError for an object that does not have .to_hash" do
32
- original = %w(cannot convert to hash)
33
-
34
- expect { Cucumber::Hash(original) }.to raise_error TypeError
35
- end
36
- end
37
- end
38
-
39
-