cucumber 11.1.1 → 12.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/VERSION +1 -1
- data/lib/cucumber/cli/configuration.rb +0 -6
- data/lib/cucumber/cli/options.rb +0 -16
- data/lib/cucumber/configuration.rb +5 -5
- data/lib/cucumber/errors.rb +43 -23
- data/lib/cucumber/events/attach_called.rb +12 -3
- data/lib/cucumber/events/envelope.rb +2 -2
- data/lib/cucumber/events/gherkin_source_parsed.rb +1 -3
- data/lib/cucumber/events/gherkin_source_read.rb +1 -1
- data/lib/cucumber/events/hook_test_step_created.rb +1 -3
- data/lib/cucumber/events/step_activated.rb +1 -1
- data/lib/cucumber/events/step_definition_registered.rb +1 -3
- data/lib/cucumber/events/test_case_created.rb +1 -1
- data/lib/cucumber/events/test_case_finished.rb +1 -1
- data/lib/cucumber/events/test_case_ready.rb +1 -1
- data/lib/cucumber/events/test_case_started.rb +1 -3
- data/lib/cucumber/events/test_run_finished.rb +1 -1
- data/lib/cucumber/events/test_run_hook_finished.rb +1 -1
- data/lib/cucumber/events/test_run_hook_started.rb +1 -3
- data/lib/cucumber/events/test_run_started.rb +1 -3
- data/lib/cucumber/events/test_step_created.rb +1 -3
- data/lib/cucumber/events/test_step_finished.rb +1 -3
- data/lib/cucumber/events/test_step_started.rb +1 -3
- data/lib/cucumber/events/undefined_parameter_type.rb +1 -1
- data/lib/cucumber/events.rb +6 -2
- data/lib/cucumber/filters/retry.rb +7 -22
- data/lib/cucumber/formatter/console_counts.rb +5 -3
- data/lib/cucumber/formatter/console_issues.rb +3 -3
- data/lib/cucumber/formatter/fail_fast.rb +2 -2
- data/lib/cucumber/formatter/html.rb +6 -4
- data/lib/cucumber/formatter/junit.rb +3 -3
- data/lib/cucumber/formatter/message_builder.rb +25 -139
- data/lib/cucumber/formatter/pretty.rb +1 -1
- data/lib/cucumber/formatter/rerun.rb +13 -41
- data/lib/cucumber/glue/hook.rb +0 -1
- data/lib/cucumber/glue/multiple_world.rb +26 -0
- data/lib/cucumber/glue/nil_world.rb +12 -0
- data/lib/cucumber/glue/registry_and_more.rb +15 -32
- data/lib/cucumber/multiline_argument/data_table.rb +5 -7
- data/lib/cucumber/retry_policy.rb +27 -0
- data/lib/cucumber/rspec/doubles.rb +1 -7
- data/lib/cucumber/runtime/meta_message_builder.rb +1 -1
- data/lib/cucumber/runtime/user_interface.rb +13 -0
- data/lib/cucumber/runtime.rb +26 -47
- metadata +51 -25
- data/lib/cucumber/events/base.rb +0 -25
- data/lib/cucumber/query.rb +0 -273
- data/lib/cucumber/repository.rb +0 -136
data/lib/cucumber/runtime.rb
CHANGED
|
@@ -1,51 +1,26 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'fileutils'
|
|
4
|
-
require 'cucumber/configuration'
|
|
5
|
-
require 'cucumber/load_path'
|
|
6
|
-
require 'cucumber/formatter/duration'
|
|
7
|
-
require 'cucumber/file_specs'
|
|
8
|
-
require 'cucumber/filters'
|
|
9
|
-
require 'cucumber/gherkin/i18n'
|
|
10
|
-
require 'cucumber/glue/registry_wrapper'
|
|
11
|
-
require 'cucumber/step_match_search'
|
|
12
|
-
require 'cucumber/messages'
|
|
13
|
-
require 'cucumber/runtime/meta_message_builder'
|
|
14
4
|
require 'sys/uname'
|
|
15
5
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def message
|
|
19
|
-
String(super).gsub('@ rb_sysopen ', '')
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
class FileException < RuntimeError
|
|
24
|
-
attr_reader :path
|
|
25
|
-
|
|
26
|
-
def initialize(original_exception, path)
|
|
27
|
-
@path = path
|
|
28
|
-
super(original_exception)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
class FileNotFoundException < FileException
|
|
33
|
-
end
|
|
6
|
+
require 'cucumber/core'
|
|
7
|
+
require 'cucumber/messages'
|
|
34
8
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
9
|
+
require_relative 'configuration'
|
|
10
|
+
require_relative 'errors'
|
|
11
|
+
require_relative 'file_specs'
|
|
12
|
+
require_relative 'filters'
|
|
13
|
+
require_relative 'load_path'
|
|
14
|
+
require_relative 'step_match_search'
|
|
40
15
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
16
|
+
require_relative 'formatter/duration'
|
|
17
|
+
require_relative 'gherkin/i18n'
|
|
18
|
+
require_relative 'glue/registry_wrapper'
|
|
19
|
+
require_relative 'runtime/meta_message_builder'
|
|
20
|
+
require_relative 'runtime/support_code'
|
|
21
|
+
require_relative 'runtime/user_interface'
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
require 'cucumber/runtime/user_interface'
|
|
48
|
-
require 'cucumber/runtime/support_code'
|
|
23
|
+
module Cucumber
|
|
49
24
|
class Runtime
|
|
50
25
|
attr_reader :results, :support_code, :configuration
|
|
51
26
|
|
|
@@ -73,7 +48,12 @@ module Cucumber
|
|
|
73
48
|
fire_install_plugin_hook
|
|
74
49
|
create_formatters
|
|
75
50
|
|
|
76
|
-
|
|
51
|
+
options = {
|
|
52
|
+
id_generator: @configuration.id_generator,
|
|
53
|
+
backtrace_filter: Cucumber::Formatter::BacktraceFilter,
|
|
54
|
+
retry_policy: @configuration.retry_policy
|
|
55
|
+
}
|
|
56
|
+
receiver = Test::Runner.new(@configuration.event_bus, **options)
|
|
77
57
|
compile features, receiver, filters, @configuration.event_bus
|
|
78
58
|
fire_after_all_hook unless dry_run?
|
|
79
59
|
@configuration.notify :test_run_finished, !failure?
|
|
@@ -109,7 +89,7 @@ module Cucumber
|
|
|
109
89
|
if @configuration.wip?
|
|
110
90
|
summary_report.test_cases.total_passed.positive?
|
|
111
91
|
else
|
|
112
|
-
!summary_report.ok?
|
|
92
|
+
!summary_report.ok? || !global_hooks_summary_report.ok?
|
|
113
93
|
end
|
|
114
94
|
end
|
|
115
95
|
|
|
@@ -197,14 +177,13 @@ module Cucumber
|
|
|
197
177
|
require 'cucumber/core/report/summary'
|
|
198
178
|
|
|
199
179
|
def create_formatters
|
|
200
|
-
# Define all
|
|
201
|
-
|
|
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) }
|
|
180
|
+
# Define the MessageBuilder - Required until all messages are generated at the source
|
|
181
|
+
message_builder
|
|
205
182
|
# `summary_report` and `global_hooks_summary_report` are used to determine the exit code
|
|
206
183
|
summary_report
|
|
207
184
|
global_hooks_summary_report
|
|
185
|
+
# Define all formatters which are specified via cli options
|
|
186
|
+
formatters
|
|
208
187
|
fail_fast_report if @configuration.fail_fast?
|
|
209
188
|
publish_banner_printer unless @configuration.publish_quiet?
|
|
210
189
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cucumber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 12.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aslak Hellesøy
|
|
@@ -49,7 +49,7 @@ dependencies:
|
|
|
49
49
|
version: '9'
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: '
|
|
52
|
+
version: '14'
|
|
53
53
|
type: :runtime
|
|
54
54
|
prerelease: false
|
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -59,27 +59,27 @@ dependencies:
|
|
|
59
59
|
version: '9'
|
|
60
60
|
- - "<"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
62
|
+
version: '14'
|
|
63
63
|
- !ruby/object:Gem::Dependency
|
|
64
64
|
name: cucumber-core
|
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version:
|
|
69
|
+
version: '20'
|
|
70
70
|
- - "<"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
72
|
+
version: '21'
|
|
73
73
|
type: :runtime
|
|
74
74
|
prerelease: false
|
|
75
75
|
version_requirements: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
|
77
77
|
- - ">="
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version:
|
|
79
|
+
version: '20'
|
|
80
80
|
- - "<"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '21'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: cucumber-cucumber-expressions
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,7 +89,7 @@ dependencies:
|
|
|
89
89
|
version: '17'
|
|
90
90
|
- - "<"
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
|
-
version: '
|
|
92
|
+
version: '21'
|
|
93
93
|
type: :runtime
|
|
94
94
|
prerelease: false
|
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -99,7 +99,7 @@ dependencies:
|
|
|
99
99
|
version: '17'
|
|
100
100
|
- - "<"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
102
|
+
version: '21'
|
|
103
103
|
- !ruby/object:Gem::Dependency
|
|
104
104
|
name: cucumber-html-formatter
|
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -109,7 +109,7 @@ dependencies:
|
|
|
109
109
|
version: '21'
|
|
110
110
|
- - "<"
|
|
111
111
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '
|
|
112
|
+
version: '25'
|
|
113
113
|
type: :runtime
|
|
114
114
|
prerelease: false
|
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -119,21 +119,41 @@ dependencies:
|
|
|
119
119
|
version: '21'
|
|
120
120
|
- - "<"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '
|
|
122
|
+
version: '25'
|
|
123
123
|
- !ruby/object:Gem::Dependency
|
|
124
|
-
name:
|
|
124
|
+
name: cucumber-query
|
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
127
|
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '1
|
|
129
|
+
version: '16.1'
|
|
130
130
|
type: :runtime
|
|
131
131
|
prerelease: false
|
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - "~>"
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '16.1'
|
|
137
|
+
- !ruby/object:Gem::Dependency
|
|
138
|
+
name: diff-lcs
|
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - ">="
|
|
135
142
|
- !ruby/object:Gem::Version
|
|
136
143
|
version: '1.5'
|
|
144
|
+
- - "<"
|
|
145
|
+
- !ruby/object:Gem::Version
|
|
146
|
+
version: '3.0'
|
|
147
|
+
type: :runtime
|
|
148
|
+
prerelease: false
|
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
150
|
+
requirements:
|
|
151
|
+
- - ">="
|
|
152
|
+
- !ruby/object:Gem::Version
|
|
153
|
+
version: '1.5'
|
|
154
|
+
- - "<"
|
|
155
|
+
- !ruby/object:Gem::Version
|
|
156
|
+
version: '3.0'
|
|
137
157
|
- !ruby/object:Gem::Dependency
|
|
138
158
|
name: logger
|
|
139
159
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -166,16 +186,22 @@ dependencies:
|
|
|
166
186
|
name: multi_test
|
|
167
187
|
requirement: !ruby/object:Gem::Requirement
|
|
168
188
|
requirements:
|
|
169
|
-
- - "
|
|
189
|
+
- - ">"
|
|
170
190
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '1
|
|
191
|
+
version: '1'
|
|
192
|
+
- - "<"
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: '4'
|
|
172
195
|
type: :runtime
|
|
173
196
|
prerelease: false
|
|
174
197
|
version_requirements: !ruby/object:Gem::Requirement
|
|
175
198
|
requirements:
|
|
176
|
-
- - "
|
|
199
|
+
- - ">"
|
|
177
200
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '1
|
|
201
|
+
version: '1'
|
|
202
|
+
- - "<"
|
|
203
|
+
- !ruby/object:Gem::Version
|
|
204
|
+
version: '4'
|
|
179
205
|
- !ruby/object:Gem::Dependency
|
|
180
206
|
name: sys-uname
|
|
181
207
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -196,14 +222,14 @@ dependencies:
|
|
|
196
222
|
requirements:
|
|
197
223
|
- - "~>"
|
|
198
224
|
- !ruby/object:Gem::Version
|
|
199
|
-
version: '
|
|
225
|
+
version: '26.0'
|
|
200
226
|
type: :development
|
|
201
227
|
prerelease: false
|
|
202
228
|
version_requirements: !ruby/object:Gem::Requirement
|
|
203
229
|
requirements:
|
|
204
230
|
- - "~>"
|
|
205
231
|
- !ruby/object:Gem::Version
|
|
206
|
-
version: '
|
|
232
|
+
version: '26.0'
|
|
207
233
|
- !ruby/object:Gem::Dependency
|
|
208
234
|
name: nokogiri
|
|
209
235
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -354,7 +380,6 @@ files:
|
|
|
354
380
|
- lib/cucumber/errors.rb
|
|
355
381
|
- lib/cucumber/events.rb
|
|
356
382
|
- lib/cucumber/events/attach_called.rb
|
|
357
|
-
- lib/cucumber/events/base.rb
|
|
358
383
|
- lib/cucumber/events/envelope.rb
|
|
359
384
|
- lib/cucumber/events/gherkin_source_parsed.rb
|
|
360
385
|
- lib/cucumber/events/gherkin_source_read.rb
|
|
@@ -434,6 +459,8 @@ files:
|
|
|
434
459
|
- lib/cucumber/glue/dsl.rb
|
|
435
460
|
- lib/cucumber/glue/hook.rb
|
|
436
461
|
- lib/cucumber/glue/invoke_in_world.rb
|
|
462
|
+
- lib/cucumber/glue/multiple_world.rb
|
|
463
|
+
- lib/cucumber/glue/nil_world.rb
|
|
437
464
|
- lib/cucumber/glue/proto_world.rb
|
|
438
465
|
- lib/cucumber/glue/registry_and_more.rb
|
|
439
466
|
- lib/cucumber/glue/registry_wrapper.rb
|
|
@@ -448,12 +475,11 @@ files:
|
|
|
448
475
|
- lib/cucumber/multiline_argument/doc_string.rb
|
|
449
476
|
- lib/cucumber/platform.rb
|
|
450
477
|
- lib/cucumber/project_initializer.rb
|
|
451
|
-
- lib/cucumber/query.rb
|
|
452
478
|
- lib/cucumber/rake.rb
|
|
453
479
|
- lib/cucumber/rake/forked_cucumber_runner.rb
|
|
454
480
|
- lib/cucumber/rake/in_process_cucumber_runner.rb
|
|
455
481
|
- lib/cucumber/rake/task.rb
|
|
456
|
-
- lib/cucumber/
|
|
482
|
+
- lib/cucumber/retry_policy.rb
|
|
457
483
|
- lib/cucumber/rspec/disable_option_parser.rb
|
|
458
484
|
- lib/cucumber/rspec/doubles.rb
|
|
459
485
|
- lib/cucumber/running_test_case.rb
|
|
@@ -490,14 +516,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
490
516
|
requirements:
|
|
491
517
|
- - ">="
|
|
492
518
|
- !ruby/object:Gem::Version
|
|
493
|
-
version: '3.
|
|
519
|
+
version: '3.3'
|
|
494
520
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
495
521
|
requirements:
|
|
496
522
|
- - ">="
|
|
497
523
|
- !ruby/object:Gem::Version
|
|
498
524
|
version: 3.2.8
|
|
499
525
|
requirements: []
|
|
500
|
-
rubygems_version: 4.0.
|
|
526
|
+
rubygems_version: 4.0.16
|
|
501
527
|
specification_version: 4
|
|
502
|
-
summary: cucumber-
|
|
528
|
+
summary: cucumber-12.0.0
|
|
503
529
|
test_files: []
|
data/lib/cucumber/events/base.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# TODO: Remove this class and use Cucumber::Core::Event::Base once v17 of core is minimum
|
|
4
|
-
module Cucumber
|
|
5
|
-
module Events
|
|
6
|
-
# An archetype of what each Cucumber Event defined in cucumber-ruby must adhere to
|
|
7
|
-
class Base
|
|
8
|
-
# The "key" name of the class to be used as the key in the event registry (Underscored name symbolized)
|
|
9
|
-
# @return [Symbol]
|
|
10
|
-
def self.event_id
|
|
11
|
-
raise 'Must be implemented in subclass'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# The properties of each event. Stored in iVar named format - where the key is the name of the iVar
|
|
15
|
-
# @return [Hash<Symbol>]
|
|
16
|
-
def to_h
|
|
17
|
-
instance_variables.to_h { |variable_name| [variable_name[1..].to_sym, instance_variable_get(variable_name)] }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def event_id
|
|
21
|
-
self.class.event_id
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
data/lib/cucumber/query.rb
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'cucumber/repository'
|
|
4
|
-
require 'cucumber/messages'
|
|
5
|
-
|
|
6
|
-
# Given one Cucumber Message, find another.
|
|
7
|
-
#
|
|
8
|
-
# Queries can be made while the test run is incomplete - and this will naturally return incomplete results
|
|
9
|
-
# see <a href="https://github.com/cucumber/messages?tab=readme-ov-file#message-overview">Cucumber Messages - Message Overview</a>
|
|
10
|
-
#
|
|
11
|
-
module Cucumber
|
|
12
|
-
class Query
|
|
13
|
-
attr_reader :repository
|
|
14
|
-
private :repository
|
|
15
|
-
|
|
16
|
-
include Cucumber::Messages::Helpers::TimeConversion
|
|
17
|
-
include Cucumber::Messages::Helpers::TestStepResultComparator
|
|
18
|
-
|
|
19
|
-
def initialize(repository)
|
|
20
|
-
@repository = repository
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# TODO: count methods (1/2) Complete
|
|
24
|
-
# Missing: countMostSevereTestStepResultStatus
|
|
25
|
-
|
|
26
|
-
# TODO: findAll methods (11/12) Complete
|
|
27
|
-
# Missing: findAllUndefinedParameterTypes
|
|
28
|
-
|
|
29
|
-
# TODO: find****By methods (16/25) Complete
|
|
30
|
-
# Missing: findSuggestionsBy (2 variants)
|
|
31
|
-
# Missing: findUnambiguousStepDefinitionBy (1 variant)
|
|
32
|
-
# Missing: findTestStepFinishedAndTestStepBy (1 variant)
|
|
33
|
-
# Missing: findAttachmentsBy (2 variants)
|
|
34
|
-
# Missing: findTestCaseDurationBy (2 variant)
|
|
35
|
-
# REDUNDANT: findLineageBy (9 variants!)
|
|
36
|
-
# REDUNDANT: findLocationOf (1 variant) - This strictly speaking isn't a findBy but is located within them
|
|
37
|
-
# To Review: findMostSevereTestStepResultBy (2 variants)
|
|
38
|
-
# To Review: findTestRunDuration (1 variant) - This strictly speaking isn't a findBy but is located within them
|
|
39
|
-
|
|
40
|
-
def count_test_cases_started
|
|
41
|
-
find_all_test_case_started.length
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def find_all_pickles
|
|
45
|
-
repository.pickle_by_id.values
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def find_all_pickle_steps
|
|
49
|
-
repository.pickle_step_by_id.values
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def find_all_step_definitions
|
|
53
|
-
repository.step_definition_by_id.values
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# This finds all test cases from the following conditions (UNION)
|
|
57
|
-
# -> Test cases that have started, but not yet finished
|
|
58
|
-
# -> Test cases that have started, finished, but that will NOT be retried
|
|
59
|
-
def find_all_test_case_started
|
|
60
|
-
repository.test_case_started_by_id.values.select do |test_case_started|
|
|
61
|
-
test_case_finished = find_test_case_finished_by(test_case_started)
|
|
62
|
-
test_case_finished.nil? || !test_case_finished.will_be_retried
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# This finds all test cases that have finished AND will not be retried
|
|
67
|
-
def find_all_test_case_finished
|
|
68
|
-
repository.test_case_finished_by_test_case_started_id.values.reject(&:will_be_retried)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def find_all_test_cases
|
|
72
|
-
repository.test_case_by_id.values
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def find_all_test_run_hook_started
|
|
76
|
-
repository.test_run_hook_started_by_id.values
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def find_all_test_run_hook_finished
|
|
80
|
-
repository.test_run_hook_finished_by_test_run_hook_started_id.values
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def find_all_test_step_started
|
|
84
|
-
repository.test_steps_started_by_test_case_started_id.values.flatten
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def find_all_test_step_finished
|
|
88
|
-
repository.test_steps_finished_by_test_case_started_id.values.flatten
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def find_all_test_steps
|
|
92
|
-
repository.test_step_by_id.values
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# This method will be called with 1 of these 3 messages
|
|
96
|
-
# [TestStep || TestRunHookStarted || TestRunHookFinished]
|
|
97
|
-
def find_hook_by(message)
|
|
98
|
-
ensure_only_message_types!(message, %i[test_step test_run_hook_started test_run_hook_finished], '#find_hook_by')
|
|
99
|
-
|
|
100
|
-
if message.is_a?(Cucumber::Messages::TestRunHookFinished)
|
|
101
|
-
test_run_hook_started_message = find_test_run_hook_started_by(message)
|
|
102
|
-
test_run_hook_started_message ? find_hook_by(test_run_hook_started_message) : nil
|
|
103
|
-
else
|
|
104
|
-
repository.hook_by_id[message.hook_id]
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def find_meta
|
|
109
|
-
repository.meta
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# This method will be called with 1 of these 2 messages
|
|
113
|
-
# [TestCaseStarted || TestCaseFinished]
|
|
114
|
-
def find_most_severe_test_step_result_by(message)
|
|
115
|
-
ensure_only_message_types!(message, %i[test_case_started test_case_finished], '#find_most_severe_test_step_result_by')
|
|
116
|
-
|
|
117
|
-
if message.is_a?(Cucumber::Messages::TestCaseStarted)
|
|
118
|
-
find_test_steps_finished_by(message)
|
|
119
|
-
.map(&:test_step_result)
|
|
120
|
-
.max_by { |test_step_result| test_step_result_rankings[test_step_result.status] }
|
|
121
|
-
# Java code: "PREVIOUS".max(comparing(TestStepResult::getStatus, new TestStepResultStatusComparator()));
|
|
122
|
-
else
|
|
123
|
-
test_case_started_message = find_test_case_started_by(message)
|
|
124
|
-
test_case_started_message && find_most_severe_test_step_result_by(test_case_started_message)
|
|
125
|
-
# Java code: return findTestCaseStartedBy(testCaseFinished).flatMap(this::findMostSevereTestStepResultBy);
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
# This method will be called with 1 of these 5 messages
|
|
130
|
-
# [TestCase || TestCaseStarted || TestCaseFinished || TestStepStarted || TestStepFinished]
|
|
131
|
-
def find_pickle_by(message)
|
|
132
|
-
ensure_only_message_types!(message, %i[test_case test_case_started test_case_finished test_step_started test_step_finished], '#find_pickle_by')
|
|
133
|
-
|
|
134
|
-
test_case_message = message.is_a?(Cucumber::Messages::TestCase) ? message : find_test_case_by(message)
|
|
135
|
-
repository.pickle_by_id[test_case_message.pickle_id]
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# This method will be called with only 1 message
|
|
139
|
-
# [TestStep]
|
|
140
|
-
def find_pickle_step_by(test_step)
|
|
141
|
-
ensure_only_message_types!(test_step, %i[test_step], '#find_pickle_step_by')
|
|
142
|
-
|
|
143
|
-
repository.pickle_step_by_id[test_step.pickle_step_id]
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
# This method will be called with only 1 message
|
|
147
|
-
# [PickleStep]
|
|
148
|
-
def find_step_by(pickle_step)
|
|
149
|
-
ensure_only_message_types!(pickle_step, %i[pickle_step], '#find_step_by')
|
|
150
|
-
|
|
151
|
-
repository.step_by_id[pickle_step.ast_node_ids.first]
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# This method will be called with only 1 message
|
|
155
|
-
# [TestStep]
|
|
156
|
-
def find_step_definitions_by(test_step)
|
|
157
|
-
ensure_only_message_types!(test_step, %i[test_step], '#find_step_definitions_by')
|
|
158
|
-
|
|
159
|
-
ids = test_step.step_definition_ids.nil? ? [] : test_step.step_definition_ids
|
|
160
|
-
ids.map { |id| repository.step_definition_by_id[id] }.compact
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
# This method will be called with 1 of these 4 messages
|
|
164
|
-
# [TestCaseStarted || TestCaseFinished || TestStepStarted || TestStepFinished]
|
|
165
|
-
def find_test_case_by(message)
|
|
166
|
-
ensure_only_message_types!(message, %i[test_case_started test_case_finished test_step_started test_step_finished], '#find_test_case_by')
|
|
167
|
-
|
|
168
|
-
test_case_started_message = message.is_a?(Cucumber::Messages::TestCaseStarted) ? message : find_test_case_started_by(message)
|
|
169
|
-
repository.test_case_by_id[test_case_started_message.test_case_id]
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
# This method will be called with 1 of these 3 messages
|
|
173
|
-
# [TestCaseFinished || TestStepStarted || TestStepFinished]
|
|
174
|
-
def find_test_case_started_by(message)
|
|
175
|
-
ensure_only_message_types!(message, %i[test_case_finished test_step_started test_step_finished], '#find_test_case_started_by')
|
|
176
|
-
|
|
177
|
-
repository.test_case_started_by_id[message.test_case_started_id]
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
# This method will be called with only 1 message
|
|
181
|
-
# [TestCaseStarted]
|
|
182
|
-
def find_test_case_finished_by(test_case_started)
|
|
183
|
-
ensure_only_message_types!(test_case_started, %i[test_case_started], '#find_test_case_finished_by')
|
|
184
|
-
|
|
185
|
-
repository.test_case_finished_by_test_case_started_id[test_case_started.id]
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def find_test_run_duration
|
|
189
|
-
if repository.test_run_started.nil? || repository.test_run_finished.nil?
|
|
190
|
-
nil
|
|
191
|
-
else
|
|
192
|
-
timestamp_to_time(repository.test_run_finished.timestamp) - timestamp_to_time(repository.test_run_started.timestamp)
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
# This method will be called with only 1 message
|
|
197
|
-
# [TestRunHookFinished]
|
|
198
|
-
def find_test_run_hook_started_by(test_run_hook_finished)
|
|
199
|
-
ensure_only_message_types!(test_run_hook_finished, %i[test_run_hook_finished], '#find_test_run_hook_started_by')
|
|
200
|
-
|
|
201
|
-
repository.test_run_hook_started_by_id[test_run_hook_finished.test_run_hook_started_id]
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
# This method will be called with only 1 message
|
|
205
|
-
# [TestRunHookStarted]
|
|
206
|
-
def find_test_run_hook_finished_by(test_run_hook_started)
|
|
207
|
-
ensure_only_message_types!(test_run_hook_started, %i[test_run_hook_started], '#find_test_run_hook_finished_by')
|
|
208
|
-
|
|
209
|
-
repository.test_run_hook_finished_by_test_run_hook_started_id[test_run_hook_started.id]
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
def find_test_run_started
|
|
213
|
-
repository.test_run_started
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
def find_test_run_finished
|
|
217
|
-
repository.test_run_finished
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
# This method will be called with 1 of these 2 messages
|
|
221
|
-
# [TestStepStarted || TestStepFinished]
|
|
222
|
-
def find_test_step_by(message)
|
|
223
|
-
ensure_only_message_types!(message, %i[test_case_started test_case_finished], '#find_test_step_by')
|
|
224
|
-
|
|
225
|
-
repository.test_step_by_id[message.test_step_id]
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
# This method will be called with 1 of these 2 messages
|
|
229
|
-
# [TestCaseStarted || TestCaseFinished]
|
|
230
|
-
def find_test_steps_started_by(message)
|
|
231
|
-
ensure_only_message_types!(message, %i[test_case_started test_case_finished], '#find_test_steps_started_by')
|
|
232
|
-
|
|
233
|
-
key = message.is_a?(Cucumber::Messages::TestCaseStarted) ? message.id : message.test_case_started_id
|
|
234
|
-
repository.test_steps_started_by_test_case_started_id.fetch(key, [])
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
# This method will be called with 1 of these 2 messages
|
|
238
|
-
# [TestCaseStarted || TestCaseFinished]
|
|
239
|
-
def find_test_steps_finished_by(message)
|
|
240
|
-
ensure_only_message_types!(message, %i[test_case_started test_case_finished], '#find_test_steps_finished_by')
|
|
241
|
-
|
|
242
|
-
if message.is_a?(Cucumber::Messages::TestCaseStarted)
|
|
243
|
-
repository.test_steps_finished_by_test_case_started_id.fetch(message.id, [])
|
|
244
|
-
else
|
|
245
|
-
test_case_started_message = find_test_case_started_by(message)
|
|
246
|
-
test_case_started_message.nil? ? [] : find_test_steps_finished_by(test_case_started_message)
|
|
247
|
-
end
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
private
|
|
251
|
-
|
|
252
|
-
def ensure_only_message_types!(supplied_message, permissible_message_types, method_name)
|
|
253
|
-
raise ArgumentError, "Supplied argument is not a Cucumber Message. Argument: #{supplied_message.class}" unless supplied_message.is_a?(Cucumber::Messages::Message)
|
|
254
|
-
|
|
255
|
-
permitted_klasses = permissible_message_types.map { |message| message_types[message] }
|
|
256
|
-
raise ArgumentError, "Supplied message type '#{supplied_message.class}' is not permitted to be used when calling #{method_name}" unless permitted_klasses.include?(supplied_message.class)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def message_types
|
|
260
|
-
{
|
|
261
|
-
pickle_step: Cucumber::Messages::PickleStep,
|
|
262
|
-
test_case: Cucumber::Messages::TestCase,
|
|
263
|
-
test_case_started: Cucumber::Messages::TestCaseStarted,
|
|
264
|
-
test_case_finished: Cucumber::Messages::TestCaseFinished,
|
|
265
|
-
test_run_hook_started: Cucumber::Messages::TestRunHookStarted,
|
|
266
|
-
test_run_hook_finished: Cucumber::Messages::TestRunHookFinished,
|
|
267
|
-
test_step: Cucumber::Messages::TestStep,
|
|
268
|
-
test_step_started: Cucumber::Messages::TestStepStarted,
|
|
269
|
-
test_step_finished: Cucumber::Messages::TestStepFinished
|
|
270
|
-
}
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
end
|