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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/History.md +131 -32
- data/Rakefile +0 -2
- data/cucumber.gemspec +4 -3
- data/examples/i18n/ht/Rakefile +6 -0
- data/examples/i18n/ht/features/adisyon.feature +17 -0
- data/examples/i18n/ht/features/divizyon.feature +10 -0
- data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +25 -0
- data/examples/i18n/ht/lib/kalkilatris.rb +14 -0
- data/examples/tcl/features/step_definitions/fib_steps.rb +1 -1
- data/features/docs/cli/dry_run.feature +48 -0
- data/features/docs/cli/exclude_files.feature +1 -2
- data/features/docs/cli/run_specific_scenarios.feature +28 -66
- data/features/docs/cli/strict_mode.feature +24 -1
- data/features/docs/defining_steps/nested_steps.feature +49 -0
- data/features/docs/defining_steps/skip_scenario.feature +31 -2
- data/features/docs/defining_steps/snippets.feature +15 -0
- data/features/docs/exception_in_after_step_hook.feature +1 -1
- data/features/docs/exception_in_around_hook.feature +80 -0
- data/features/docs/extending_cucumber/custom_filter.feature +29 -0
- data/features/docs/extending_cucumber/custom_formatter.feature +65 -7
- data/features/docs/formatters/debug_formatter.feature +24 -17
- data/features/docs/formatters/json_formatter.feature +65 -1
- data/features/docs/formatters/junit_formatter.feature +40 -0
- data/features/docs/formatters/pretty_formatter.feature +42 -0
- data/features/docs/formatters/rerun_formatter.feature +3 -2
- data/features/docs/getting_started.feature +1 -1
- data/features/docs/{wire_protocol_erb.feature → wire_protocol/erb_configuration.feature} +2 -2
- data/features/docs/wire_protocol/handle_unexpected_response.feature +30 -0
- data/features/docs/wire_protocol/invoke_message.feature +216 -0
- data/features/docs/wire_protocol/readme.md +26 -0
- data/features/docs/wire_protocol/snippets_message.feature +51 -0
- data/features/docs/wire_protocol/step_matches_message.feature +81 -0
- data/features/docs/{wire_protocol_table_diffing.feature → wire_protocol/table_diffing.feature} +1 -0
- data/features/docs/{wire_protocol_tags.feature → wire_protocol/tags.feature} +1 -0
- data/features/docs/{wire_protocol_timeouts.feature → wire_protocol/timeouts.feature} +1 -0
- data/features/docs/work_in_progress.feature +1 -1
- data/features/docs/writing_support_code/after_hooks.feature +24 -0
- data/features/docs/writing_support_code/around_hooks.feature +31 -0
- data/features/docs/writing_support_code/before_hook.feature +7 -3
- data/features/docs/writing_support_code/tagged_hooks.feature +44 -6
- data/features/lib/step_definitions/wire_steps.rb +18 -1
- data/features/lib/support/fake_wire_server.rb +10 -7
- data/lib/cucumber/cli/configuration.rb +6 -11
- data/lib/cucumber/cli/main.rb +2 -2
- data/lib/cucumber/cli/options.rb +8 -1
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +1 -1
- data/lib/cucumber/encoding.rb +5 -0
- data/lib/cucumber/errors.rb +8 -0
- data/lib/cucumber/file_specs.rb +3 -1
- data/lib/cucumber/filters/activate_steps.rb +33 -0
- data/lib/cucumber/filters/apply_after_hooks.rb +9 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +12 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +12 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +9 -0
- data/lib/cucumber/{runtime → filters}/gated_receiver.rb +5 -1
- data/lib/cucumber/filters/prepare_world.rb +45 -0
- data/lib/cucumber/filters/quit.rb +28 -0
- data/lib/cucumber/filters/randomizer.rb +40 -0
- data/lib/cucumber/{runtime → filters}/tag_limits/test_case_index.rb +4 -2
- data/lib/cucumber/{runtime → filters}/tag_limits/verifier.rb +4 -2
- data/lib/cucumber/filters/tag_limits.rb +45 -0
- data/lib/cucumber/filters.rb +9 -0
- data/lib/cucumber/formatter/ansicolor.rb +0 -8
- data/lib/cucumber/formatter/console.rb +37 -20
- data/lib/cucumber/formatter/debug.rb +1 -8
- data/lib/cucumber/formatter/fanout.rb +27 -0
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +10 -9
- data/lib/cucumber/formatter/html.rb +31 -6
- data/lib/cucumber/formatter/ignore_missing_messages.rb +20 -0
- data/lib/cucumber/formatter/junit.rb +97 -2
- data/lib/cucumber/formatter/legacy_api/adapter.rb +1060 -0
- data/lib/cucumber/formatter/legacy_api/ast.rb +376 -0
- data/lib/cucumber/formatter/legacy_api/results.rb +51 -0
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +30 -0
- data/lib/cucumber/formatter/pretty.rb +14 -0
- data/lib/cucumber/formatter/progress.rb +10 -0
- data/lib/cucumber/formatter/rerun.rb +14 -88
- data/lib/cucumber/hooks.rb +97 -0
- data/lib/cucumber/language_support/language_methods.rb +0 -54
- data/lib/cucumber/multiline_argument/data_table.rb +41 -29
- data/lib/cucumber/platform.rb +3 -3
- data/lib/cucumber/project_initializer.rb +43 -0
- data/lib/cucumber/rb_support/rb_hook.rb +2 -2
- data/lib/cucumber/rb_support/rb_step_definition.rb +11 -2
- data/lib/cucumber/rb_support/rb_transform.rb +3 -1
- data/lib/cucumber/rb_support/rb_world.rb +2 -2
- data/lib/cucumber/rb_support/snippet.rb +1 -1
- data/lib/cucumber/rspec/doubles.rb +1 -1
- data/lib/cucumber/running_test_case.rb +115 -0
- data/lib/cucumber/runtime/after_hooks.rb +24 -0
- data/lib/cucumber/runtime/before_hooks.rb +23 -0
- data/lib/cucumber/runtime/for_programming_languages.rb +4 -8
- data/lib/cucumber/runtime/step_hooks.rb +22 -0
- data/lib/cucumber/runtime/support_code.rb +70 -5
- data/lib/cucumber/runtime.rb +56 -112
- data/lib/cucumber/step_match.rb +26 -2
- data/lib/cucumber.rb +7 -3
- data/spec/cucumber/cli/configuration_spec.rb +16 -1
- data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
- data/spec/cucumber/core_ext/instance_exec_spec.rb +4 -0
- data/spec/cucumber/file_specs_spec.rb +21 -2
- data/spec/cucumber/filters/activate_steps_spec.rb +57 -0
- data/spec/cucumber/{runtime → filters}/gated_receiver_spec.rb +3 -3
- data/spec/cucumber/{runtime → filters}/tag_limits/test_case_index_spec.rb +3 -3
- data/spec/cucumber/{runtime → filters}/tag_limits/verifier_spec.rb +4 -4
- data/spec/cucumber/{runtime/tag_limits/filter_spec.rb → filters/tag_limits_spec.rb} +6 -6
- data/spec/cucumber/formatter/debug_spec.rb +25 -530
- data/spec/cucumber/formatter/html_spec.rb +140 -0
- data/spec/cucumber/formatter/junit_spec.rb +212 -156
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +2090 -0
- data/spec/cucumber/formatter/pretty_spec.rb +248 -2
- data/spec/cucumber/formatter/rerun_spec.rb +107 -0
- data/spec/cucumber/formatter/spec_helper.rb +17 -8
- data/spec/cucumber/hooks_spec.rb +30 -0
- data/spec/cucumber/multiline_argument/data_table_spec.rb +53 -47
- data/spec/cucumber/project_initializer_spec.rb +87 -0
- data/spec/cucumber/rb_support/rb_language_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +32 -7
- data/spec/cucumber/rb_support/rb_transform_spec.rb +20 -0
- data/spec/cucumber/rb_support/snippet_spec.rb +6 -6
- data/spec/cucumber/running_test_case_spec.rb +83 -0
- data/spec/cucumber/runtime_spec.rb +1 -5
- data/spec/spec_helper.rb +3 -4
- metadata +149 -107
- data/bin/cuke +0 -60
- data/features/docs/extending_cucumber/formatter_callbacks.feature +0 -370
- data/features/docs/output_from_hooks.feature +0 -128
- data/features/docs/report_called_undefined_steps.feature +0 -57
- data/features/docs/wire_protocol.feature +0 -337
- data/gem_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/gem_tasks/yard/default/layout/html/footer.erb +0 -5
- data/gem_tasks/yard/default/layout/html/index.erb +0 -1
- data/gem_tasks/yard/default/layout/html/layout.erb +0 -25
- data/gem_tasks/yard/default/layout/html/logo.erb +0 -1
- data/gem_tasks/yard/default/layout/html/setup.rb +0 -4
- data/gem_tasks/yard.rake +0 -43
- data/lib/cucumber/mappings.rb +0 -238
- data/lib/cucumber/reports/legacy_formatter.rb +0 -1349
- data/lib/cucumber/runtime/results.rb +0 -64
- data/lib/cucumber/runtime/tag_limits/filter.rb +0 -31
- data/lib/cucumber/runtime/tag_limits.rb +0 -15
- data/spec/cucumber/mappings_spec.rb +0 -180
- data/spec/cucumber/reports/legacy_formatter_spec.rb +0 -1860
- data/spec/cucumber/runtime/results_spec.rb +0 -88
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
module Cucumber
|
|
2
|
-
class Runtime
|
|
3
|
-
|
|
4
|
-
class Results
|
|
5
|
-
def initialize(configuration)
|
|
6
|
-
@configuration = configuration
|
|
7
|
-
|
|
8
|
-
# Optimization - quicker lookup.
|
|
9
|
-
@inserted_steps = {}
|
|
10
|
-
@inserted_scenarios = {}
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def configure(new_configuration)
|
|
14
|
-
@configuration = Configuration.parse(new_configuration)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def step_visited(step) #:nodoc:
|
|
18
|
-
step_id = step.object_id
|
|
19
|
-
|
|
20
|
-
unless @inserted_steps.has_key?(step_id)
|
|
21
|
-
@inserted_steps[step_id] = step
|
|
22
|
-
steps.push(step)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def scenario_visited(scenario) #:nodoc:
|
|
27
|
-
scenario_id = scenario.object_id
|
|
28
|
-
|
|
29
|
-
unless @inserted_scenarios.has_key?(scenario_id)
|
|
30
|
-
@inserted_scenarios[scenario_id] = scenario
|
|
31
|
-
scenarios.push(scenario)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def steps(status = nil) #:nodoc:
|
|
36
|
-
@steps ||= []
|
|
37
|
-
if(status)
|
|
38
|
-
@steps.select{|step| step.status == status}
|
|
39
|
-
else
|
|
40
|
-
@steps
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def scenarios(status = nil) #:nodoc:
|
|
45
|
-
@scenarios ||= []
|
|
46
|
-
if(status)
|
|
47
|
-
@scenarios.select{|scenario| scenario.status == status}
|
|
48
|
-
else
|
|
49
|
-
@scenarios
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def failure?
|
|
54
|
-
if @configuration.wip?
|
|
55
|
-
scenarios(:passed).any?
|
|
56
|
-
else
|
|
57
|
-
scenarios(:failed).any? || steps(:failed).any? ||
|
|
58
|
-
(@configuration.strict? && (steps(:undefined).any? || steps(:pending).any?))
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require "cucumber/runtime/gated_receiver"
|
|
2
|
-
|
|
3
|
-
module Cucumber
|
|
4
|
-
class Runtime
|
|
5
|
-
module TagLimits
|
|
6
|
-
class Filter
|
|
7
|
-
def initialize(tag_limits, receiver)
|
|
8
|
-
@gated_receiver = GatedReceiver.new(receiver)
|
|
9
|
-
@test_case_index = TestCaseIndex.new
|
|
10
|
-
@verifier = Verifier.new(tag_limits)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def test_case(test_case)
|
|
14
|
-
gated_receiver.test_case(test_case)
|
|
15
|
-
test_case_index.add(test_case)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def done
|
|
19
|
-
verifier.verify!(test_case_index)
|
|
20
|
-
gated_receiver.done
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
attr_reader :gated_receiver
|
|
26
|
-
attr_reader :test_case_index
|
|
27
|
-
attr_reader :verifier
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require "cucumber/runtime/tag_limits/test_case_index"
|
|
2
|
-
require "cucumber/runtime/tag_limits/filter"
|
|
3
|
-
require "cucumber/runtime/tag_limits/verifier"
|
|
4
|
-
|
|
5
|
-
module Cucumber
|
|
6
|
-
class Runtime
|
|
7
|
-
module TagLimits
|
|
8
|
-
class TagLimitExceededError < StandardError
|
|
9
|
-
def initialize(*limit_breaches)
|
|
10
|
-
super(limit_breaches.map(&:to_s).join("\n"))
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
require_relative "../../lib/cucumber/mappings"
|
|
2
|
-
require 'cucumber/core'
|
|
3
|
-
require 'cucumber/core/gherkin/writer'
|
|
4
|
-
|
|
5
|
-
module Cucumber
|
|
6
|
-
class Mappings
|
|
7
|
-
describe Scenario do
|
|
8
|
-
include Core::Gherkin::Writer
|
|
9
|
-
include Core
|
|
10
|
-
let(:ruby) { double.as_null_object }
|
|
11
|
-
let(:runtime) do
|
|
12
|
-
double(
|
|
13
|
-
load_programming_language: ruby,
|
|
14
|
-
step_match: double
|
|
15
|
-
)
|
|
16
|
-
end
|
|
17
|
-
let(:mappings) { Mappings.new(runtime) }
|
|
18
|
-
let(:report) { double.as_null_object }
|
|
19
|
-
|
|
20
|
-
it "responds to #source_tag_names" do
|
|
21
|
-
define_gherkin do
|
|
22
|
-
feature 'test', tags: '@foo @bar' do
|
|
23
|
-
scenario 'test', tags: '@baz' do
|
|
24
|
-
step 'passing'
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
before do |scenario|
|
|
30
|
-
expect(scenario.source_tag_names).to eq %w(@foo @bar @baz)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe "#failed?" do
|
|
35
|
-
|
|
36
|
-
it "is true if the test case is in a failed state" do
|
|
37
|
-
define_gherkin do
|
|
38
|
-
feature do
|
|
39
|
-
scenario do
|
|
40
|
-
step 'failing'
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
allow(runtime).to receive(:step_match) do |step_name|
|
|
46
|
-
if step_name == 'failing'
|
|
47
|
-
step_match = double
|
|
48
|
-
allow(step_match).to receive(:invoke) { fail }
|
|
49
|
-
step_match
|
|
50
|
-
else
|
|
51
|
-
raise Cucumber::Undefined
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
after do |test_case|
|
|
56
|
-
expect(test_case).to be_failed
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
describe "#scenario_outline" do
|
|
63
|
-
|
|
64
|
-
# TODO: is this actually desired behaviour?
|
|
65
|
-
it "throws a NoMethodError when the test case is from a scenario" do
|
|
66
|
-
define_gherkin do
|
|
67
|
-
feature do
|
|
68
|
-
scenario do
|
|
69
|
-
step 'passing'
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
before do |test_case|
|
|
75
|
-
expect{ test_case.scenario_outline }.to raise_error(NoMethodError)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it "points to self when the test case is from a scenario outline" do
|
|
80
|
-
define_gherkin do
|
|
81
|
-
feature do
|
|
82
|
-
scenario_outline 'outline' do
|
|
83
|
-
step 'passing'
|
|
84
|
-
|
|
85
|
-
examples 'examples' do
|
|
86
|
-
row 'a'
|
|
87
|
-
row '1'
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
before do |test_case|
|
|
94
|
-
expect(test_case.scenario_outline).to_not be_nil
|
|
95
|
-
expect(test_case.scenario_outline.name).to eq "Scenario Outline: outline, examples (row 1)"
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
describe "#outline?" do
|
|
102
|
-
|
|
103
|
-
it "returns false when the test case is from a scenario" do
|
|
104
|
-
define_gherkin do
|
|
105
|
-
feature do
|
|
106
|
-
scenario do
|
|
107
|
-
step 'passing'
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
before do |test_case|
|
|
113
|
-
expect(test_case).to_not be_an_outline
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
it "returns true when the test case is from a scenario" do
|
|
118
|
-
define_gherkin do
|
|
119
|
-
feature do
|
|
120
|
-
scenario_outline do
|
|
121
|
-
step 'passing'
|
|
122
|
-
|
|
123
|
-
examples 'examples' do
|
|
124
|
-
row 'a'
|
|
125
|
-
row '1'
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
before do |test_case|
|
|
132
|
-
expect(test_case).to be_an_outline
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
end
|
|
137
|
-
attr_accessor :gherkin_docs
|
|
138
|
-
|
|
139
|
-
def define_gherkin(&block)
|
|
140
|
-
self.gherkin_docs = [gherkin(&block)]
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def before
|
|
144
|
-
# TODO: the complexity of this stubbing shows we need to clean up the interface
|
|
145
|
-
scenario_spy = nil
|
|
146
|
-
allow(ruby).to receive(:hooks_for) do |phase, scenario|
|
|
147
|
-
if phase == :before
|
|
148
|
-
hook = double
|
|
149
|
-
expect(hook).to receive(:invoke) do |phase, scenario|
|
|
150
|
-
scenario_spy = scenario
|
|
151
|
-
end
|
|
152
|
-
[hook]
|
|
153
|
-
else
|
|
154
|
-
[]
|
|
155
|
-
end
|
|
156
|
-
end
|
|
157
|
-
execute gherkin_docs, mappings, report
|
|
158
|
-
yield scenario_spy
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def after
|
|
162
|
-
# TODO: the complexity of this stubbing shows we need to clean up the interface
|
|
163
|
-
scenario_spy = nil
|
|
164
|
-
allow(ruby).to receive(:hooks_for) do |phase, scenario|
|
|
165
|
-
if phase == :after
|
|
166
|
-
hook = double
|
|
167
|
-
expect(hook).to receive(:invoke) do |phase, scenario|
|
|
168
|
-
scenario_spy = scenario
|
|
169
|
-
end
|
|
170
|
-
[hook]
|
|
171
|
-
else
|
|
172
|
-
[]
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
execute gherkin_docs, mappings, report
|
|
176
|
-
yield scenario_spy
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
end
|