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.
- checksums.yaml +4 -4
- data/.travis.yml +22 -10
- data/CONTRIBUTING.md +13 -0
- data/Gemfile +11 -4
- data/History.md +19 -1
- data/README.md +1 -1
- data/cucumber.gemspec +2 -2
- data/cucumber.yml +2 -2
- data/features/docs/api/listen_for_events.feature +7 -6
- data/features/docs/cli/help.feature +8 -0
- data/features/docs/cli/retry_failing_tests.feature +51 -16
- data/features/docs/defining_steps/nested_steps_i18n.feature +2 -0
- data/features/docs/defining_steps/printing_messages.feature +0 -1
- data/features/docs/defining_steps/skip_scenario.feature +0 -34
- data/features/docs/extending_cucumber/custom_formatter.feature +2 -30
- data/features/docs/formatters/summary_formatter.feature +34 -0
- data/features/docs/gherkin/unicode_table.feature +1 -1
- data/features/docs/post_configuration_hook.feature +0 -16
- data/features/docs/writing_support_code/world.feature +129 -0
- data/features/lib/step_definitions/aruba_steps.rb +1 -0
- data/features/lib/step_definitions/cli_steps.rb +4 -0
- data/features/lib/step_definitions/cucumber_steps.rb +1 -0
- data/features/lib/step_definitions/iso-8859-1_steps.rb +1 -0
- data/features/lib/step_definitions/json_steps.rb +1 -0
- data/features/lib/step_definitions/junit_steps.rb +1 -0
- data/features/lib/step_definitions/language_steps.rb +1 -0
- data/features/lib/step_definitions/profile_steps.rb +1 -0
- data/features/lib/step_definitions/retry_steps.rb +32 -12
- data/features/lib/step_definitions/ruby_steps.rb +1 -0
- data/features/lib/step_definitions/wire_steps.rb +1 -0
- data/features/lib/support/env.rb +2 -1
- data/features/lib/support/fake_wire_server.rb +1 -0
- data/features/lib/support/feature_factory.rb +1 -0
- data/features/lib/support/normalise_output.rb +1 -0
- data/gem_tasks/contributors.rake +1 -0
- data/gem_tasks/cov.rake +1 -0
- data/gem_tasks/cucumber.rake +1 -0
- data/gem_tasks/downloads.rb +1 -0
- data/gem_tasks/environment.rake +1 -0
- data/gem_tasks/examples.rake +2 -1
- data/gem_tasks/fix_cr_lf.rake +2 -1
- data/gem_tasks/flog.rake +2 -1
- data/gem_tasks/rspec.rake +1 -0
- data/gem_tasks/sass.rake +2 -1
- data/lib/autotest/cucumber.rb +1 -0
- data/lib/autotest/cucumber_mixin.rb +1 -0
- data/lib/autotest/cucumber_rails.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
- data/lib/autotest/cucumber_rspec.rb +1 -0
- data/lib/autotest/cucumber_rspec2.rb +1 -0
- data/lib/autotest/discover.rb +1 -0
- data/lib/cucumber.rb +1 -13
- data/lib/cucumber/cli/configuration.rb +3 -6
- data/lib/cucumber/cli/main.rb +2 -1
- data/lib/cucumber/cli/options.rb +239 -173
- data/lib/cucumber/cli/profile_loader.rb +1 -0
- data/lib/cucumber/cli/rerun_file.rb +1 -0
- data/lib/cucumber/configuration.rb +40 -19
- data/lib/cucumber/constantize.rb +1 -0
- data/lib/cucumber/core_ext/instance_exec.rb +1 -0
- data/lib/cucumber/core_ext/string.rb +1 -0
- data/lib/cucumber/deprecate.rb +1 -0
- data/lib/cucumber/encoding.rb +1 -0
- data/lib/cucumber/errors.rb +3 -1
- data/lib/cucumber/events.rb +13 -3
- data/lib/cucumber/events/step_definition_registered.rb +24 -0
- data/lib/cucumber/events/step_match.rb +4 -1
- data/lib/cucumber/events/test_run_finished.rb +12 -0
- data/lib/cucumber/file_specs.rb +1 -0
- data/lib/cucumber/filters.rb +2 -0
- data/lib/cucumber/filters/activate_steps.rb +2 -1
- data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
- data/lib/cucumber/filters/gated_receiver.rb +1 -0
- data/lib/cucumber/filters/prepare_world.rb +1 -0
- data/lib/cucumber/filters/quit.rb +1 -0
- data/lib/cucumber/filters/randomizer.rb +1 -0
- data/lib/cucumber/filters/retry.rb +3 -3
- data/lib/cucumber/filters/tag_limits.rb +1 -0
- data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
- data/lib/cucumber/filters/tag_limits/verifier.rb +1 -0
- data/lib/cucumber/formatter/ansicolor.rb +1 -0
- data/lib/cucumber/formatter/backtrace_filter.rb +3 -2
- data/lib/cucumber/formatter/console.rb +61 -52
- data/lib/cucumber/formatter/console_counts.rb +57 -0
- data/lib/cucumber/formatter/console_issues.rb +37 -0
- data/lib/cucumber/formatter/debug.rb +1 -0
- data/lib/cucumber/formatter/duration.rb +1 -0
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/fail_fast.rb +4 -2
- data/lib/cucumber/formatter/fanout.rb +1 -0
- data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
- data/lib/cucumber/formatter/html.rb +6 -5
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
- data/lib/cucumber/formatter/interceptor.rb +1 -0
- data/lib/cucumber/formatter/io.rb +1 -0
- data/lib/cucumber/formatter/json.rb +15 -13
- data/lib/cucumber/formatter/json_pretty.rb +1 -0
- data/lib/cucumber/formatter/junit.rb +13 -11
- data/lib/cucumber/formatter/legacy_api/adapter.rb +28 -32
- data/lib/cucumber/formatter/legacy_api/ast.rb +1 -0
- data/lib/cucumber/formatter/legacy_api/results.rb +1 -0
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
- data/lib/cucumber/formatter/pretty.rb +7 -1
- data/lib/cucumber/formatter/progress.rb +56 -13
- data/lib/cucumber/formatter/rerun.rb +15 -18
- data/lib/cucumber/formatter/stepdefs.rb +1 -0
- data/lib/cucumber/formatter/steps.rb +1 -0
- data/lib/cucumber/formatter/summary.rb +43 -20
- data/lib/cucumber/formatter/unicode.rb +1 -0
- data/lib/cucumber/formatter/usage.rb +26 -21
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +1 -0
- data/lib/cucumber/gherkin/formatter/escaping.rb +1 -0
- data/lib/cucumber/gherkin/i18n.rb +1 -0
- data/lib/cucumber/gherkin/steps_parser.rb +1 -0
- data/lib/cucumber/hooks.rb +1 -0
- data/lib/cucumber/load_path.rb +1 -0
- data/lib/cucumber/multiline_argument.rb +1 -2
- data/lib/cucumber/multiline_argument/data_table.rb +3 -1
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/project_initializer.rb +2 -1
- data/lib/cucumber/rake/task.rb +1 -0
- data/lib/cucumber/rb_support/rb_dsl.rb +11 -9
- data/lib/cucumber/rb_support/rb_hook.rb +1 -0
- data/lib/cucumber/rb_support/rb_language.rb +19 -8
- data/lib/cucumber/rb_support/rb_step_definition.rb +1 -0
- data/lib/cucumber/rb_support/rb_transform.rb +1 -0
- data/lib/cucumber/rb_support/rb_world.rb +42 -20
- data/lib/cucumber/rb_support/snippet.rb +2 -1
- data/lib/cucumber/rspec/disable_option_parser.rb +1 -0
- data/lib/cucumber/rspec/doubles.rb +1 -0
- data/lib/cucumber/running_test_case.rb +1 -25
- data/lib/cucumber/runtime.rb +15 -10
- data/lib/cucumber/runtime/after_hooks.rb +1 -0
- data/lib/cucumber/runtime/before_hooks.rb +1 -0
- data/lib/cucumber/runtime/for_programming_languages.rb +1 -0
- data/lib/cucumber/runtime/step_hooks.rb +1 -0
- data/lib/cucumber/runtime/support_code.rb +1 -0
- data/lib/cucumber/runtime/user_interface.rb +1 -0
- data/lib/cucumber/step_argument.rb +1 -0
- data/lib/cucumber/step_definition_light.rb +1 -0
- data/lib/cucumber/step_definitions.rb +1 -0
- data/lib/cucumber/step_match.rb +1 -0
- data/lib/cucumber/step_match_search.rb +1 -0
- data/lib/cucumber/term/ansicolor.rb +1 -0
- data/lib/cucumber/unit.rb +1 -0
- data/lib/cucumber/version +1 -1
- data/lib/simplecov_setup.rb +1 -0
- data/spec/cucumber/cli/configuration_spec.rb +1 -0
- data/spec/cucumber/cli/main_spec.rb +1 -0
- data/spec/cucumber/cli/options_spec.rb +1 -0
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -0
- data/spec/cucumber/cli/rerun_spec.rb +1 -0
- data/spec/cucumber/configuration_spec.rb +1 -0
- data/spec/cucumber/constantize_spec.rb +1 -0
- data/spec/cucumber/core_ext/instance_exec_spec.rb +1 -0
- data/spec/cucumber/file_specs_spec.rb +1 -0
- data/spec/cucumber/filters/activate_steps_spec.rb +9 -6
- data/spec/cucumber/filters/gated_receiver_spec.rb +1 -0
- data/spec/cucumber/filters/retry_spec.rb +27 -21
- data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +1 -0
- data/spec/cucumber/filters/tag_limits/verifier_spec.rb +1 -0
- data/spec/cucumber/filters/tag_limits_spec.rb +1 -0
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -0
- data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
- data/spec/cucumber/formatter/debug_spec.rb +1 -0
- data/spec/cucumber/formatter/duration_spec.rb +1 -0
- data/spec/cucumber/formatter/fail_fast_spec.rb +5 -5
- data/spec/cucumber/formatter/html_spec.rb +6 -1
- data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
- data/spec/cucumber/formatter/json_spec.rb +29 -28
- data/spec/cucumber/formatter/junit_spec.rb +1 -0
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +8 -3
- data/spec/cucumber/formatter/pretty_spec.rb +1 -0
- data/spec/cucumber/formatter/progress_spec.rb +2 -1
- data/spec/cucumber/formatter/rerun_spec.rb +70 -64
- data/spec/cucumber/formatter/spec_helper.rb +8 -7
- data/spec/cucumber/hooks_spec.rb +1 -0
- data/spec/cucumber/multiline_argument/data_table_spec.rb +1 -0
- data/spec/cucumber/project_initializer_spec.rb +2 -1
- data/spec/cucumber/rake/forked_spec.rb +1 -0
- data/spec/cucumber/rake/task_spec.rb +1 -0
- data/spec/cucumber/rb_support/rb_language_spec.rb +81 -3
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +1 -0
- data/spec/cucumber/rb_support/rb_transform_spec.rb +1 -0
- data/spec/cucumber/rb_support/rb_world_spec.rb +2 -1
- data/spec/cucumber/rb_support/snippet_spec.rb +1 -0
- data/spec/cucumber/running_test_case_spec.rb +1 -0
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +1 -0
- data/spec/cucumber/runtime/support_code_spec.rb +1 -0
- data/spec/cucumber/runtime_spec.rb +1 -0
- data/spec/cucumber/step_argument_spec.rb +1 -0
- data/spec/cucumber/step_match_search_spec.rb +1 -0
- data/spec/cucumber/step_match_spec.rb +1 -0
- data/spec/cucumber/world/pending_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/standard_step_actions.rb +1 -0
- metadata +24 -23
- data/lib/cucumber/ast.rb +0 -13
- data/lib/cucumber/events/after_test_case.rb +0 -25
- data/lib/cucumber/events/after_test_step.rb +0 -30
- data/lib/cucumber/events/before_test_case.rb +0 -18
- data/lib/cucumber/events/before_test_step.rb +0 -23
- data/lib/cucumber/events/bus.rb +0 -86
- data/lib/cucumber/events/finished_testing.rb +0 -9
- data/lib/cucumber/formatter/event_bus_report.rb +0 -38
- data/spec/cucumber/events/bus_spec.rb +0 -94
- data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
- data/spec/cucumber_spec.rb +0 -39
@@ -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
|
-
|
data/spec/cucumber_spec.rb
DELETED
@@ -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
|
-
|