cucumber 11.0.0 → 11.1.1
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/README.md +15 -6
- data/VERSION +1 -1
- data/lib/cucumber/cli/main.rb +22 -0
- data/lib/cucumber/configuration.rb +4 -0
- data/lib/cucumber/events/attach_called.rb +19 -0
- data/lib/cucumber/events/base.rb +25 -0
- data/lib/cucumber/events/envelope.rb +11 -2
- data/lib/cucumber/events/gherkin_source_parsed.rb +12 -3
- data/lib/cucumber/events/gherkin_source_read.rb +11 -3
- data/lib/cucumber/events/hook_test_step_created.rb +12 -2
- data/lib/cucumber/events/step_activated.rb +13 -7
- data/lib/cucumber/events/step_definition_registered.rb +12 -4
- data/lib/cucumber/events/test_case_created.rb +11 -3
- data/lib/cucumber/events/test_case_finished.rb +12 -4
- data/lib/cucumber/events/test_case_ready.rb +10 -4
- data/lib/cucumber/events/test_case_started.rb +11 -2
- data/lib/cucumber/events/test_run_finished.rb +10 -3
- data/lib/cucumber/events/test_run_hook_finished.rb +11 -3
- data/lib/cucumber/events/test_run_hook_started.rb +10 -1
- data/lib/cucumber/events/test_run_started.rb +11 -2
- data/lib/cucumber/events/test_step_created.rb +12 -2
- data/lib/cucumber/events/test_step_finished.rb +12 -2
- data/lib/cucumber/events/test_step_started.rb +11 -2
- data/lib/cucumber/events/undefined_parameter_type.rb +11 -3
- data/lib/cucumber/events.rb +1 -0
- data/lib/cucumber/filters/fire_before_all_hooks.rb +36 -0
- data/lib/cucumber/formatter/console.rb +19 -11
- data/lib/cucumber/formatter/console_issues.rb +5 -5
- data/lib/cucumber/formatter/duration_extractor.rb +0 -2
- data/lib/cucumber/formatter/fail_fast.rb +3 -4
- data/lib/cucumber/formatter/global_hooks_summary.rb +36 -0
- data/lib/cucumber/formatter/html.rb +6 -4
- data/lib/cucumber/formatter/json.rb +14 -10
- data/lib/cucumber/formatter/junit.rb +4 -6
- data/lib/cucumber/formatter/message.rb +5 -6
- data/lib/cucumber/formatter/message_builder.rb +213 -205
- data/lib/cucumber/formatter/message_handlers.rb +13 -0
- data/lib/cucumber/formatter/pretty.rb +7 -9
- data/lib/cucumber/formatter/progress.rb +1 -2
- data/lib/cucumber/formatter/rerun.rb +12 -5
- data/lib/cucumber/formatter/summary.rb +15 -1
- data/lib/cucumber/formatter/usage.rb +1 -2
- data/lib/cucumber/glue/proto_world.rb +3 -2
- data/lib/cucumber/glue/registry_and_more.rb +98 -9
- data/lib/cucumber/runtime/user_interface.rb +4 -2
- data/lib/cucumber/runtime.rb +38 -17
- metadata +11 -15
- data/lib/cucumber/formatter/errors.rb +0 -9
- data/lib/cucumber/formatter/fanout.rb +0 -28
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +0 -34
- data/lib/cucumber/formatter/query/pickle_by_test.rb +0 -28
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +0 -42
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +0 -45
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'cucumber/
|
|
4
|
-
|
|
3
|
+
require 'cucumber/query'
|
|
4
|
+
|
|
5
|
+
require_relative 'io'
|
|
5
6
|
|
|
6
7
|
module Cucumber
|
|
7
8
|
module Formatter
|
|
8
|
-
class Rerun
|
|
9
|
+
class Rerun
|
|
10
|
+
include Io
|
|
11
|
+
|
|
9
12
|
def initialize(config)
|
|
13
|
+
@config = config
|
|
10
14
|
@io = ensure_io(config.out_stream, config.error_stream)
|
|
11
|
-
|
|
15
|
+
@repository = Cucumber::Repository.new
|
|
16
|
+
@query = Cucumber::Query.new(@repository)
|
|
17
|
+
config.on_event :envelope, &method(:output_envelope)
|
|
12
18
|
end
|
|
13
19
|
|
|
14
|
-
def output_envelope(
|
|
20
|
+
def output_envelope(event)
|
|
21
|
+
envelope = event.envelope
|
|
15
22
|
@repository.update(envelope)
|
|
16
23
|
finish_report if envelope.test_run_finished
|
|
17
24
|
end
|
|
@@ -4,12 +4,13 @@ require 'cucumber/formatter/io'
|
|
|
4
4
|
require 'cucumber/formatter/console'
|
|
5
5
|
require 'cucumber/formatter/console_counts'
|
|
6
6
|
require 'cucumber/formatter/console_issues'
|
|
7
|
+
require 'cucumber/formatter/backtrace_filter'
|
|
7
8
|
require 'cucumber/core/test/result'
|
|
8
9
|
require 'cucumber/formatter/ast_lookup'
|
|
9
10
|
|
|
10
11
|
module Cucumber
|
|
11
12
|
module Formatter
|
|
12
|
-
# Summary formatter, outputting
|
|
13
|
+
# Summary formatter, outputting feature / scenario titles plus failure details
|
|
13
14
|
class Summary
|
|
14
15
|
include Io
|
|
15
16
|
include Console
|
|
@@ -20,6 +21,7 @@ module Cucumber
|
|
|
20
21
|
@ast_lookup = AstLookup.new(config)
|
|
21
22
|
@counts = ConsoleCounts.new(@config)
|
|
22
23
|
@issues = ConsoleIssues.new(@config, @ast_lookup)
|
|
24
|
+
@failed_results = []
|
|
23
25
|
@start_time = Time.now
|
|
24
26
|
|
|
25
27
|
@config.on_event :test_case_started do |event|
|
|
@@ -31,9 +33,14 @@ module Cucumber
|
|
|
31
33
|
print_result event.result
|
|
32
34
|
end
|
|
33
35
|
|
|
36
|
+
@config.on_event :test_step_finished do |event|
|
|
37
|
+
collect_failed_result(event.test_step, event.result)
|
|
38
|
+
end
|
|
39
|
+
|
|
34
40
|
@config.on_event :test_run_finished do |_event|
|
|
35
41
|
duration = Time.now - @start_time
|
|
36
42
|
@io.puts
|
|
43
|
+
print_elements(@failed_results, :failed, 'steps')
|
|
37
44
|
print_statistics(duration, @config, @counts, @issues)
|
|
38
45
|
end
|
|
39
46
|
end
|
|
@@ -61,6 +68,13 @@ module Cucumber
|
|
|
61
68
|
def print_result(result)
|
|
62
69
|
@io.puts format_string(result, result.to_sym)
|
|
63
70
|
end
|
|
71
|
+
|
|
72
|
+
def collect_failed_result(test_step, result)
|
|
73
|
+
return if test_step.hook?
|
|
74
|
+
|
|
75
|
+
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
|
|
76
|
+
@failed_results << result if result.failed?
|
|
77
|
+
end
|
|
64
78
|
end
|
|
65
79
|
end
|
|
66
80
|
end
|
|
@@ -32,8 +32,7 @@ module Cucumber
|
|
|
32
32
|
@total_duration = 0
|
|
33
33
|
@matches = {}
|
|
34
34
|
config.on_event :step_activated do |event|
|
|
35
|
-
test_step
|
|
36
|
-
@matches[test_step.to_s] = step_match
|
|
35
|
+
@matches[event.test_step.to_s] = event.step_match
|
|
37
36
|
end
|
|
38
37
|
config.on_event :step_definition_registered, &method(:on_step_definition_registered)
|
|
39
38
|
end
|
|
@@ -94,9 +94,10 @@ module Cucumber
|
|
|
94
94
|
media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil?
|
|
95
95
|
file = File.read(file, mode: 'rb')
|
|
96
96
|
end
|
|
97
|
-
|
|
97
|
+
# We pass in the concept of whether the file is streamed to ensure that the envelope encoding is correct
|
|
98
|
+
super(file, media_type, filename)
|
|
98
99
|
rescue StandardError
|
|
99
|
-
super
|
|
100
|
+
super(file, media_type, filename)
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
# Mark the matched step as pending.
|
|
@@ -4,6 +4,8 @@ require 'cucumber/cucumber_expressions/parameter_type_registry'
|
|
|
4
4
|
require 'cucumber/cucumber_expressions/cucumber_expression'
|
|
5
5
|
require 'cucumber/cucumber_expressions/regular_expression'
|
|
6
6
|
require 'cucumber/cucumber_expressions/cucumber_expression_generator'
|
|
7
|
+
require 'cucumber/messages/helpers/time_conversion'
|
|
8
|
+
|
|
7
9
|
require 'cucumber/glue/dsl'
|
|
8
10
|
require 'cucumber/glue/snippet'
|
|
9
11
|
require 'cucumber/glue/hook'
|
|
@@ -13,6 +15,7 @@ require 'cucumber/glue/world_factory'
|
|
|
13
15
|
require 'cucumber/gherkin/i18n'
|
|
14
16
|
require 'multi_test'
|
|
15
17
|
require 'cucumber/step_match'
|
|
18
|
+
require 'cucumber/events/base'
|
|
16
19
|
require 'cucumber/events/step_definition_registered'
|
|
17
20
|
|
|
18
21
|
module Cucumber
|
|
@@ -48,6 +51,8 @@ module Cucumber
|
|
|
48
51
|
class RegistryAndMore
|
|
49
52
|
attr_reader :current_world, :step_definitions
|
|
50
53
|
|
|
54
|
+
include Cucumber::Messages::Helpers::TimeConversion
|
|
55
|
+
|
|
51
56
|
all_keywords = ::Gherkin::DIALECTS.keys.map do |dialect_name|
|
|
52
57
|
dialect = ::Gherkin::Dialect.for(dialect_name)
|
|
53
58
|
dialect.given_keywords + dialect.when_keywords + dialect.then_keywords + dialect.and_keywords + dialect.but_keywords
|
|
@@ -98,13 +103,20 @@ module Cucumber
|
|
|
98
103
|
def register_rb_step_definition(string_or_regexp, proc_or_sym, options)
|
|
99
104
|
step_definition = StepDefinition.new(@configuration.id_generator.new_id, self, string_or_regexp, proc_or_sym, options)
|
|
100
105
|
@step_definitions << step_definition
|
|
101
|
-
@configuration.notify
|
|
106
|
+
@configuration.notify(:step_definition_registered, step_definition)
|
|
107
|
+
@configuration.notify(:envelope, step_definition.to_envelope)
|
|
102
108
|
step_definition
|
|
103
109
|
rescue Cucumber::CucumberExpressions::UndefinedParameterTypeError => e
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
@configuration.notify(:undefined_parameter_type, e.undefined_parameter_type_name, string_or_regexp)
|
|
111
|
+
# Move the below code into cucumber-expressions. Once done. Switch the line for
|
|
112
|
+
# @configuration.notify(:envelope, e.to_envelope(string_or_regexp))
|
|
113
|
+
to_envelope = Cucumber::Messages::Envelope.new(
|
|
114
|
+
undefined_parameter_type: Cucumber::Messages::UndefinedParameterType.new(
|
|
115
|
+
name: e.undefined_parameter_type_name,
|
|
116
|
+
expression: string_or_regexp
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
@configuration.notify(:envelope, to_envelope)
|
|
108
120
|
end
|
|
109
121
|
|
|
110
122
|
def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
|
|
@@ -131,7 +143,7 @@ module Cucumber
|
|
|
131
143
|
|
|
132
144
|
def begin_scenario(test_case)
|
|
133
145
|
@current_world = WorldFactory.new(@world_proc).create_world
|
|
134
|
-
@current_world.extend(ProtoWorld.for(@runtime, test_case
|
|
146
|
+
@current_world.extend(ProtoWorld.for(@runtime, test_case&.language))
|
|
135
147
|
MultiTest.extend_with_best_assertion_library(@current_world)
|
|
136
148
|
@current_world.add_modules!(@world_modules || [], @namespaced_world_modules || {})
|
|
137
149
|
end
|
|
@@ -147,15 +159,27 @@ module Cucumber
|
|
|
147
159
|
end
|
|
148
160
|
|
|
149
161
|
def before_all
|
|
162
|
+
set_up_world_for_global_hooks
|
|
163
|
+
all_succeeded = true
|
|
164
|
+
# Run each `BeforeAll` hook. Ensuring that we store the overall result as the worst status
|
|
150
165
|
hooks[:before_all].each do |hook|
|
|
151
|
-
invoke_run_hook(hook, 'BeforeAll')
|
|
166
|
+
result = invoke_run_hook(hook, 'BeforeAll')
|
|
167
|
+
all_succeeded = false unless result
|
|
152
168
|
end
|
|
169
|
+
@current_world = nil
|
|
170
|
+
all_succeeded
|
|
153
171
|
end
|
|
154
172
|
|
|
155
173
|
def after_all
|
|
174
|
+
set_up_world_for_global_hooks
|
|
175
|
+
all_succeeded = true
|
|
176
|
+
# Run each `AfterAll` hook. Ensuring that we store the overall result as the worst status
|
|
156
177
|
hooks[:after_all].each do |hook|
|
|
157
|
-
invoke_run_hook(hook, 'AfterAll')
|
|
178
|
+
result = invoke_run_hook(hook, 'AfterAll')
|
|
179
|
+
all_succeeded = false unless result
|
|
158
180
|
end
|
|
181
|
+
@current_world = nil
|
|
182
|
+
all_succeeded
|
|
159
183
|
end
|
|
160
184
|
|
|
161
185
|
def add_hook(type, hook)
|
|
@@ -182,16 +206,76 @@ module Cucumber
|
|
|
182
206
|
|
|
183
207
|
def invoke_run_hook(hook, pseudo_method)
|
|
184
208
|
@configuration.notify(:test_run_hook_started, hook)
|
|
209
|
+
|
|
210
|
+
current_test_run_hook_started_id = @configuration.id_generator.new_id
|
|
211
|
+
started_envelope = test_run_hook_started_envelope(hook, current_test_run_hook_started_id)
|
|
212
|
+
@configuration.notify(:envelope, started_envelope)
|
|
213
|
+
|
|
185
214
|
timer = Core::Test::Timer.new.start
|
|
186
215
|
begin
|
|
187
216
|
hook.invoke(pseudo_method, [])
|
|
188
217
|
@configuration.notify(:test_run_hook_finished, hook, Core::Test::Result::Passed.new(timer.duration))
|
|
218
|
+
finished_envelope = test_run_hook_finished_envelope(Core::Test::Result::Passed.new(timer.duration), current_test_run_hook_started_id)
|
|
219
|
+
@configuration.notify(:envelope, finished_envelope)
|
|
220
|
+
true
|
|
189
221
|
rescue StandardError => e
|
|
190
222
|
@configuration.notify(:test_run_hook_finished, hook, Core::Test::Result::Failed.new(timer.duration, e))
|
|
191
|
-
|
|
223
|
+
finished_envelope = test_run_hook_finished_envelope(Core::Test::Result::Failed.new(timer.duration, e), current_test_run_hook_started_id)
|
|
224
|
+
@configuration.notify(:envelope, finished_envelope)
|
|
225
|
+
false
|
|
192
226
|
end
|
|
193
227
|
end
|
|
194
228
|
|
|
229
|
+
def test_run_hook_started_envelope(hook, id)
|
|
230
|
+
Cucumber::Messages::Envelope.new(
|
|
231
|
+
test_run_hook_started: Cucumber::Messages::TestRunHookStarted.new(
|
|
232
|
+
id: id,
|
|
233
|
+
hook_id: hook.id,
|
|
234
|
+
test_run_started_id: @configuration.test_run_started_id,
|
|
235
|
+
timestamp: time_to_timestamp(Time.now)
|
|
236
|
+
)
|
|
237
|
+
)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def test_run_hook_finished_envelope(test_result, test_run_hook_started_id)
|
|
241
|
+
result = test_result
|
|
242
|
+
result_message = result.to_message
|
|
243
|
+
|
|
244
|
+
if result.failed?
|
|
245
|
+
result_message = Cucumber::Messages::TestStepResult.new(
|
|
246
|
+
status: result_message.status,
|
|
247
|
+
duration: result_message.duration,
|
|
248
|
+
message: create_error_message(result.exception),
|
|
249
|
+
exception: create_exception_object(result, result.exception)
|
|
250
|
+
)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
Cucumber::Messages::Envelope.new(
|
|
254
|
+
test_run_hook_finished: Cucumber::Messages::TestRunHookFinished.new(
|
|
255
|
+
test_run_hook_started_id: test_run_hook_started_id,
|
|
256
|
+
timestamp: time_to_timestamp(Time.now),
|
|
257
|
+
result: result_message
|
|
258
|
+
)
|
|
259
|
+
)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def create_error_message(message_element)
|
|
263
|
+
<<~ERROR_MESSAGE
|
|
264
|
+
#{message_element.message} (#{message_element.class})
|
|
265
|
+
#{message_element.backtrace}
|
|
266
|
+
ERROR_MESSAGE
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def create_exception_object(result, message_element)
|
|
270
|
+
return unless result.failed?
|
|
271
|
+
|
|
272
|
+
Cucumber::Messages::Exception.new(
|
|
273
|
+
type: message_element.class,
|
|
274
|
+
message: message_element.message,
|
|
275
|
+
stack_trace: message_element.backtrace.join("\n")
|
|
276
|
+
)
|
|
277
|
+
end
|
|
278
|
+
|
|
195
279
|
def parameter_type_envelope(parameter_type)
|
|
196
280
|
# TODO: should this be moved to Cucumber::Expression::ParameterType#to_envelope ??
|
|
197
281
|
# Note: that would mean that cucumber-expression would depend on cucumber-messages
|
|
@@ -221,6 +305,11 @@ module Cucumber
|
|
|
221
305
|
def hooks
|
|
222
306
|
@hooks ||= Hash.new { |h, k| h[k] = [] }
|
|
223
307
|
end
|
|
308
|
+
|
|
309
|
+
def set_up_world_for_global_hooks
|
|
310
|
+
# We don't need a language as we're just creating a world object to attach the BeforeAll / AfterAll hooks to
|
|
311
|
+
begin_scenario(nil)
|
|
312
|
+
end
|
|
224
313
|
end
|
|
225
314
|
end
|
|
226
315
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'timeout'
|
|
4
|
+
require 'cucumber/events/attach_called'
|
|
4
5
|
|
|
5
6
|
module Cucumber
|
|
6
7
|
class Runtime
|
|
7
8
|
module UserInterface
|
|
8
|
-
attr_writer :
|
|
9
|
+
attr_writer :configuration
|
|
9
10
|
|
|
10
11
|
# Suspends execution and prompts +question+ to the console (STDOUT).
|
|
11
12
|
# An operator (manual tester) can then enter a line of text and hit
|
|
@@ -42,7 +43,8 @@ module Cucumber
|
|
|
42
43
|
# The embedded data may or may not be ignored, depending on what kind of formatter(s) are active.
|
|
43
44
|
#
|
|
44
45
|
def attach(src, media_type, filename)
|
|
45
|
-
@
|
|
46
|
+
@configuration.notify(:attach_called, src, media_type, filename)
|
|
47
|
+
self
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
private
|
data/lib/cucumber/runtime.rb
CHANGED
|
@@ -6,7 +6,6 @@ require 'cucumber/load_path'
|
|
|
6
6
|
require 'cucumber/formatter/duration'
|
|
7
7
|
require 'cucumber/file_specs'
|
|
8
8
|
require 'cucumber/filters'
|
|
9
|
-
require 'cucumber/formatter/fanout'
|
|
10
9
|
require 'cucumber/gherkin/i18n'
|
|
11
10
|
require 'cucumber/glue/registry_wrapper'
|
|
12
11
|
require 'cucumber/step_match_search'
|
|
@@ -72,15 +71,12 @@ module Cucumber
|
|
|
72
71
|
|
|
73
72
|
load_step_definitions
|
|
74
73
|
fire_install_plugin_hook
|
|
75
|
-
|
|
76
|
-
# TODO: can we remove this state?
|
|
77
|
-
self.visitor = report
|
|
74
|
+
create_formatters
|
|
78
75
|
|
|
79
76
|
receiver = Test::Runner.new(@configuration.event_bus)
|
|
80
77
|
compile features, receiver, filters, @configuration.event_bus
|
|
81
|
-
@configuration.notify :test_run_finished, !failure?
|
|
82
|
-
|
|
83
78
|
fire_after_all_hook unless dry_run?
|
|
79
|
+
@configuration.notify :test_run_finished, !failure?
|
|
84
80
|
end
|
|
85
81
|
|
|
86
82
|
def features_paths
|
|
@@ -113,7 +109,7 @@ module Cucumber
|
|
|
113
109
|
if @configuration.wip?
|
|
114
110
|
summary_report.test_cases.total_passed.positive?
|
|
115
111
|
else
|
|
116
|
-
!summary_report.ok?(strict: @configuration.strict)
|
|
112
|
+
!summary_report.ok?(strict: @configuration.strict) || !global_hooks_summary_report.ok?
|
|
117
113
|
end
|
|
118
114
|
end
|
|
119
115
|
|
|
@@ -123,10 +119,6 @@ module Cucumber
|
|
|
123
119
|
@support_code.fire_hook(:install_plugin, @configuration, registry_wrapper)
|
|
124
120
|
end
|
|
125
121
|
|
|
126
|
-
def fire_before_all_hook # :nodoc:
|
|
127
|
-
@support_code.fire_hook(:before_all)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
122
|
def fire_after_all_hook # :nodoc:
|
|
131
123
|
@support_code.fire_hook(:after_all)
|
|
132
124
|
end
|
|
@@ -136,6 +128,22 @@ module Cucumber
|
|
|
136
128
|
@features ||= feature_files.map do |path|
|
|
137
129
|
source = NormalisedEncodingFile.read(path)
|
|
138
130
|
@configuration.notify :gherkin_source_read, path, source
|
|
131
|
+
|
|
132
|
+
# TODO: When core is v17+ switch the below code out to the following
|
|
133
|
+
# Cucumber::Core::Gherkin::Document.new(path, source).tap do |document|
|
|
134
|
+
# @configuration.notify(:envelope, document.to_envelope)
|
|
135
|
+
# end
|
|
136
|
+
to_envelope =
|
|
137
|
+
Cucumber::Messages::Envelope.new(
|
|
138
|
+
source: Cucumber::Messages::Source.new(
|
|
139
|
+
uri: path,
|
|
140
|
+
data: source,
|
|
141
|
+
media_type: 'text/x.cucumber.gherkin+plain'
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
@configuration.notify(:envelope, to_envelope)
|
|
146
|
+
|
|
139
147
|
Cucumber::Core::Gherkin::Document.new(path, source)
|
|
140
148
|
end
|
|
141
149
|
end
|
|
@@ -188,19 +196,31 @@ module Cucumber
|
|
|
188
196
|
require 'cucumber/formatter/publish_banner_printer'
|
|
189
197
|
require 'cucumber/core/report/summary'
|
|
190
198
|
|
|
191
|
-
def
|
|
192
|
-
|
|
199
|
+
def create_formatters
|
|
200
|
+
# Define all formatters which are specified via cli options
|
|
201
|
+
formatters
|
|
202
|
+
# Define the MessageBuilder formatter - Required until all messages are generated at the source
|
|
203
|
+
# Skip when a user formatter already inherits from MessageBuilder (e.g. HTML) to avoid sending every event twice.
|
|
204
|
+
message_builder unless formatters.any? { |f| f.is_a?(Formatter::MessageBuilder) }
|
|
205
|
+
# `summary_report` and `global_hooks_summary_report` are used to determine the exit code
|
|
206
|
+
summary_report
|
|
207
|
+
global_hooks_summary_report
|
|
208
|
+
fail_fast_report if @configuration.fail_fast?
|
|
209
|
+
publish_banner_printer unless @configuration.publish_quiet?
|
|
210
|
+
end
|
|
193
211
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
reports << publish_banner_printer unless @configuration.publish_quiet?
|
|
197
|
-
@report ||= Formatter::Fanout.new(reports)
|
|
212
|
+
def message_builder
|
|
213
|
+
@message_builder ||= Formatter::MessageBuilder.new(@configuration)
|
|
198
214
|
end
|
|
199
215
|
|
|
200
216
|
def summary_report
|
|
201
217
|
@summary_report ||= Core::Report::Summary.new(@configuration.event_bus)
|
|
202
218
|
end
|
|
203
219
|
|
|
220
|
+
def global_hooks_summary_report
|
|
221
|
+
@global_hooks_summary_report ||= Formatter::GlobalHooksSummary.new(@configuration)
|
|
222
|
+
end
|
|
223
|
+
|
|
204
224
|
def fail_fast_report
|
|
205
225
|
@fail_fast_report ||= Formatter::FailFast.new(@configuration)
|
|
206
226
|
end
|
|
@@ -256,6 +276,7 @@ module Cucumber
|
|
|
256
276
|
filters << Filters::ApplyAfterHooks.new(@support_code)
|
|
257
277
|
filters << Filters::ApplyAroundHooks.new(@support_code)
|
|
258
278
|
filters << Filters::BroadcastTestRunStartedEvent.new(@configuration)
|
|
279
|
+
filters << Filters::FireBeforeAllHooks.new(@support_code)
|
|
259
280
|
filters << Filters::Quit.new
|
|
260
281
|
end
|
|
261
282
|
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cucumber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 11.
|
|
4
|
+
version: 11.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aslak Hellesøy
|
|
8
8
|
- Matt Wynne
|
|
9
9
|
- Steve Tooke
|
|
10
10
|
- Luke Hill
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: base64
|
|
@@ -197,14 +196,14 @@ dependencies:
|
|
|
197
196
|
requirements:
|
|
198
197
|
- - "~>"
|
|
199
198
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '
|
|
199
|
+
version: '24.0'
|
|
201
200
|
type: :development
|
|
202
201
|
prerelease: false
|
|
203
202
|
version_requirements: !ruby/object:Gem::Requirement
|
|
204
203
|
requirements:
|
|
205
204
|
- - "~>"
|
|
206
205
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: '
|
|
206
|
+
version: '24.0'
|
|
208
207
|
- !ruby/object:Gem::Dependency
|
|
209
208
|
name: nokogiri
|
|
210
209
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -354,6 +353,8 @@ files:
|
|
|
354
353
|
- lib/cucumber/encoding.rb
|
|
355
354
|
- lib/cucumber/errors.rb
|
|
356
355
|
- lib/cucumber/events.rb
|
|
356
|
+
- lib/cucumber/events/attach_called.rb
|
|
357
|
+
- lib/cucumber/events/base.rb
|
|
357
358
|
- lib/cucumber/events/envelope.rb
|
|
358
359
|
- lib/cucumber/events/gherkin_source_parsed.rb
|
|
359
360
|
- lib/cucumber/events/gherkin_source_read.rb
|
|
@@ -381,6 +382,7 @@ files:
|
|
|
381
382
|
- lib/cucumber/filters/apply_before_hooks.rb
|
|
382
383
|
- lib/cucumber/filters/broadcast_test_case_ready_event.rb
|
|
383
384
|
- lib/cucumber/filters/broadcast_test_run_started_event.rb
|
|
385
|
+
- lib/cucumber/filters/fire_before_all_hooks.rb
|
|
384
386
|
- lib/cucumber/filters/gated_receiver.rb
|
|
385
387
|
- lib/cucumber/filters/prepare_world.rb
|
|
386
388
|
- lib/cucumber/filters/quit.rb
|
|
@@ -400,9 +402,8 @@ files:
|
|
|
400
402
|
- lib/cucumber/formatter/curl_option_parser.rb
|
|
401
403
|
- lib/cucumber/formatter/duration.rb
|
|
402
404
|
- lib/cucumber/formatter/duration_extractor.rb
|
|
403
|
-
- lib/cucumber/formatter/errors.rb
|
|
404
405
|
- lib/cucumber/formatter/fail_fast.rb
|
|
405
|
-
- lib/cucumber/formatter/
|
|
406
|
+
- lib/cucumber/formatter/global_hooks_summary.rb
|
|
406
407
|
- lib/cucumber/formatter/html.rb
|
|
407
408
|
- lib/cucumber/formatter/http_io.rb
|
|
408
409
|
- lib/cucumber/formatter/ignore_missing_messages.rb
|
|
@@ -413,13 +414,10 @@ files:
|
|
|
413
414
|
- lib/cucumber/formatter/junit.rb
|
|
414
415
|
- lib/cucumber/formatter/message.rb
|
|
415
416
|
- lib/cucumber/formatter/message_builder.rb
|
|
417
|
+
- lib/cucumber/formatter/message_handlers.rb
|
|
416
418
|
- lib/cucumber/formatter/pretty.rb
|
|
417
419
|
- lib/cucumber/formatter/progress.rb
|
|
418
420
|
- lib/cucumber/formatter/publish_banner_printer.rb
|
|
419
|
-
- lib/cucumber/formatter/query/hook_by_test_step.rb
|
|
420
|
-
- lib/cucumber/formatter/query/pickle_by_test.rb
|
|
421
|
-
- lib/cucumber/formatter/query/step_definitions_by_test_step.rb
|
|
422
|
-
- lib/cucumber/formatter/query/test_case_started_by_test_case.rb
|
|
423
421
|
- lib/cucumber/formatter/rerun.rb
|
|
424
422
|
- lib/cucumber/formatter/stepdefs.rb
|
|
425
423
|
- lib/cucumber/formatter/steps.rb
|
|
@@ -484,7 +482,6 @@ metadata:
|
|
|
484
482
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
|
485
483
|
source_code_uri: https://github.com/cucumber/cucumber-ruby
|
|
486
484
|
funding_uri: https://opencollective.com/cucumber
|
|
487
|
-
post_install_message:
|
|
488
485
|
rdoc_options:
|
|
489
486
|
- "--charset=UTF-8"
|
|
490
487
|
require_paths:
|
|
@@ -500,8 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
500
497
|
- !ruby/object:Gem::Version
|
|
501
498
|
version: 3.2.8
|
|
502
499
|
requirements: []
|
|
503
|
-
rubygems_version:
|
|
504
|
-
signing_key:
|
|
500
|
+
rubygems_version: 4.0.10
|
|
505
501
|
specification_version: 4
|
|
506
|
-
summary: cucumber-11.
|
|
502
|
+
summary: cucumber-11.1.1
|
|
507
503
|
test_files: []
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Cucumber
|
|
4
|
-
module Formatter
|
|
5
|
-
# Forwards any messages sent to this object to all recipients
|
|
6
|
-
# that respond to that message.
|
|
7
|
-
class Fanout < BasicObject
|
|
8
|
-
attr_reader :recipients
|
|
9
|
-
private :recipients
|
|
10
|
-
|
|
11
|
-
def initialize(recipients)
|
|
12
|
-
@recipients = recipients
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def method_missing(message, *args)
|
|
16
|
-
super unless recipients
|
|
17
|
-
|
|
18
|
-
recipients.each do |recipient|
|
|
19
|
-
recipient.send(message, *args) if recipient.respond_to?(message)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def respond_to_missing?(name, include_private = false)
|
|
24
|
-
recipients.any? { |recipient| recipient.respond_to?(name, include_private) } || super(name, include_private)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'cucumber/formatter/errors'
|
|
4
|
-
|
|
5
|
-
module Cucumber
|
|
6
|
-
module Formatter
|
|
7
|
-
module Query
|
|
8
|
-
class HookByTestStep
|
|
9
|
-
def initialize(config)
|
|
10
|
-
@hook_id_by_test_step_id = {}
|
|
11
|
-
|
|
12
|
-
config.on_event :test_step_created, &method(:on_test_step_created)
|
|
13
|
-
config.on_event :hook_test_step_created, &method(:on_hook_test_step_created)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def hook_id(test_step)
|
|
17
|
-
return @hook_id_by_test_step_id[test_step.id] if @hook_id_by_test_step_id.key?(test_step.id)
|
|
18
|
-
|
|
19
|
-
raise TestStepUnknownError, "No hook found for #{test_step.id} }. Known: #{@hook_id_by_test_step_id.keys}"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def on_test_step_created(event)
|
|
25
|
-
@hook_id_by_test_step_id[event.test_step.id] = nil
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def on_hook_test_step_created(event)
|
|
29
|
-
@hook_id_by_test_step_id[event.test_step.id] = event.hook.id
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'cucumber/formatter/errors'
|
|
4
|
-
|
|
5
|
-
module Cucumber
|
|
6
|
-
module Formatter
|
|
7
|
-
module Query
|
|
8
|
-
class PickleByTest
|
|
9
|
-
def initialize(config)
|
|
10
|
-
@pickle_id_by_test_case_id = {}
|
|
11
|
-
config.on_event :test_case_created, &method(:on_test_case_created)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def pickle_id(test_case)
|
|
15
|
-
return @pickle_id_by_test_case_id[test_case.id] if @pickle_id_by_test_case_id.key?(test_case.id)
|
|
16
|
-
|
|
17
|
-
raise TestCaseUnknownError, "No pickle found for #{test_case.id} }. Known: #{@pickle_id_by_test_case_id.keys}"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
def on_test_case_created(event)
|
|
23
|
-
@pickle_id_by_test_case_id[event.test_case.id] = event.pickle.id
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'cucumber/formatter/errors'
|
|
4
|
-
|
|
5
|
-
module Cucumber
|
|
6
|
-
module Formatter
|
|
7
|
-
module Query
|
|
8
|
-
class StepDefinitionsByTestStep
|
|
9
|
-
def initialize(config)
|
|
10
|
-
@step_definition_ids_by_test_step_id = {}
|
|
11
|
-
@step_match_arguments_by_test_step_id = {}
|
|
12
|
-
|
|
13
|
-
config.on_event :test_step_created, &method(:on_test_step_created)
|
|
14
|
-
config.on_event :step_activated, &method(:on_step_activated)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def step_definition_ids(test_step)
|
|
18
|
-
return @step_definition_ids_by_test_step_id[test_step.id] if @step_definition_ids_by_test_step_id.key?(test_step.id)
|
|
19
|
-
|
|
20
|
-
raise TestStepUnknownError, "No step definition found for #{test_step.id} }. Known: #{@step_definition_ids_by_test_step_id.keys}"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def step_match_arguments(test_step)
|
|
24
|
-
return @step_match_arguments_by_test_step_id[test_step.id] if @step_match_arguments_by_test_step_id.key?(test_step.id)
|
|
25
|
-
|
|
26
|
-
raise TestStepUnknownError, "No step match arguments found for #{test_step.id} }. Known: #{@step_match_arguments_by_test_step_id.keys}"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def on_test_step_created(event)
|
|
32
|
-
@step_definition_ids_by_test_step_id[event.test_step.id] = []
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def on_step_activated(event)
|
|
36
|
-
@step_definition_ids_by_test_step_id[event.test_step.id] << event.step_match.step_definition.id
|
|
37
|
-
@step_match_arguments_by_test_step_id[event.test_step.id] = event.step_match.step_arguments
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|