cucumber 11.1.0 → 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 +28 -0
- 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 +7 -2
- data/lib/cucumber/filters/retry.rb +7 -22
- data/lib/cucumber/formatter/console.rb +5 -5
- data/lib/cucumber/formatter/console_counts.rb +5 -3
- data/lib/cucumber/formatter/console_issues.rb +3 -3
- data/lib/cucumber/formatter/duration_extractor.rb +0 -2
- data/lib/cucumber/formatter/fail_fast.rb +2 -2
- data/lib/cucumber/formatter/html.rb +10 -6
- data/lib/cucumber/formatter/json.rb +10 -8
- data/lib/cucumber/formatter/junit.rb +3 -3
- data/lib/cucumber/formatter/message.rb +1 -5
- data/lib/cucumber/formatter/message_builder.rb +39 -147
- data/lib/cucumber/formatter/message_handlers.rb +13 -0
- data/lib/cucumber/formatter/pretty.rb +7 -6
- data/lib/cucumber/formatter/progress.rb +1 -0
- data/lib/cucumber/formatter/rerun.rb +15 -42
- data/lib/cucumber/formatter/summary.rb +15 -1
- 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/proto_world.rb +4 -5
- 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 +18 -3
- data/lib/cucumber/runtime.rb +34 -53
- metadata +53 -26
- data/lib/cucumber/events/base.rb +0 -25
- data/lib/cucumber/formatter/fanout.rb +0 -28
- data/lib/cucumber/query.rb +0 -273
- data/lib/cucumber/repository.rb +0 -136
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1afa805afc19084236a0c669140643f73d58830be94b68ce95101093ee1ac094
|
|
4
|
+
data.tar.gz: e0000b36b86fc3a28dd727b11fb3b449996d0219d4bcc17bacfad8a4d5fcdc56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40f7f93918b8de9376adca4c9a0d8b78f365f629d7244116a5247b795b64b3b9c592515f4dc93eab7f6a700610facc0b745ad06360833a36b4bb99fcc7080727
|
|
7
|
+
data.tar.gz: bdfe41db58fc69daea12ccc35f5b52e8623ca590db609e85228eb6c34f772516de59a51e11cd5ac8d6426de3dbabd3df05966a3df58cd9f46fbc4342b59a26e5
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
12.0.0
|
|
@@ -27,8 +27,6 @@ module Cucumber
|
|
|
27
27
|
@args = args
|
|
28
28
|
@options.parse!(args)
|
|
29
29
|
arrange_formats
|
|
30
|
-
raise("You can't use both --strict and --wip") if strict.strict? && wip?
|
|
31
|
-
|
|
32
30
|
set_environment_variables
|
|
33
31
|
end
|
|
34
32
|
|
|
@@ -44,10 +42,6 @@ module Cucumber
|
|
|
44
42
|
Integer(@options[:seed] || rand(0xFFFF))
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
def strict
|
|
48
|
-
@options[:strict]
|
|
49
|
-
end
|
|
50
|
-
|
|
51
45
|
def wip?
|
|
52
46
|
@options[:wip]
|
|
53
47
|
end
|
data/lib/cucumber/cli/options.rb
CHANGED
|
@@ -132,10 +132,6 @@ module Cucumber
|
|
|
132
132
|
opts.on('-q', '--quiet', 'Alias for --no-snippets --no-source --no-duration --publish-quiet.') { shut_up }
|
|
133
133
|
opts.on('--no-duration', "Don't print the duration at the end of the summary") { set_option :duration, false }
|
|
134
134
|
opts.on('-b', '--backtrace', 'Show full backtrace for all errors.') { Cucumber.use_full_backtrace = true }
|
|
135
|
-
opts.on('-S', '--[no-]strict', *strict_msg) { |setting| set_strict(setting) }
|
|
136
|
-
opts.on('--[no-]strict-undefined', 'Fail if there are any undefined results.') { |setting| set_strict(setting, :undefined) }
|
|
137
|
-
opts.on('--[no-]strict-pending', 'Fail if there are any pending results.') { |setting| set_strict(setting, :pending) }
|
|
138
|
-
opts.on('--[no-]strict-flaky', 'Fail if there are any flaky results.') { |setting| set_strict(setting, :flaky) }
|
|
139
135
|
opts.on('-w', '--wip', 'Fail if there are any passing scenarios.') { set_option :wip }
|
|
140
136
|
opts.on('-v', '--verbose', 'Show the files and features loaded.') { set_option :verbose }
|
|
141
137
|
opts.on('-g', '--guess', 'Guess best match for Ambiguous steps.') { set_option :guess }
|
|
@@ -289,13 +285,6 @@ module Cucumber
|
|
|
289
285
|
]
|
|
290
286
|
end
|
|
291
287
|
|
|
292
|
-
def strict_msg
|
|
293
|
-
[
|
|
294
|
-
'Fail if there are any strict affected results ',
|
|
295
|
-
'(that is undefined, pending or flaky results).'
|
|
296
|
-
]
|
|
297
|
-
end
|
|
298
|
-
|
|
299
288
|
def parse_formats(value)
|
|
300
289
|
formatter, *formatter_options = value.split(',')
|
|
301
290
|
options_hash = Hash[formatter_options.map { |string| string.split('=') }]
|
|
@@ -467,10 +456,6 @@ module Cucumber
|
|
|
467
456
|
@options[:duration] = false
|
|
468
457
|
end
|
|
469
458
|
|
|
470
|
-
def set_strict(setting, type = nil)
|
|
471
|
-
@options[:strict].set_strict(setting, type)
|
|
472
|
-
end
|
|
473
|
-
|
|
474
459
|
def stdout_formats
|
|
475
460
|
@options[:formats].select { |_, _, output| output == @out_stream }
|
|
476
461
|
end
|
|
@@ -528,7 +513,6 @@ module Cucumber
|
|
|
528
513
|
@options[:source] &= other_options[:source]
|
|
529
514
|
@options[:snippets] &= other_options[:snippets]
|
|
530
515
|
@options[:duration] &= other_options[:duration]
|
|
531
|
-
@options[:strict] = other_options[:strict].merge!(@options[:strict])
|
|
532
516
|
@options[:dry_run] |= other_options[:dry_run]
|
|
533
517
|
|
|
534
518
|
@profiles += other_options.profiles
|
|
@@ -6,6 +6,7 @@ require 'cucumber/events'
|
|
|
6
6
|
require 'cucumber/messages'
|
|
7
7
|
require 'cucumber/core/event_bus'
|
|
8
8
|
require 'cucumber/core/test/result'
|
|
9
|
+
require 'cucumber/retry_policy'
|
|
9
10
|
require 'forwardable'
|
|
10
11
|
require 'cucumber'
|
|
11
12
|
|
|
@@ -23,7 +24,6 @@ module Cucumber
|
|
|
23
24
|
{
|
|
24
25
|
autoload_code_paths: %w[features/support features/step_definitions],
|
|
25
26
|
filters: [],
|
|
26
|
-
strict: Cucumber::Core::Test::Result::StrictConfiguration.new,
|
|
27
27
|
require: [],
|
|
28
28
|
dry_run: false,
|
|
29
29
|
fail_fast: false,
|
|
@@ -114,10 +114,6 @@ module Cucumber
|
|
|
114
114
|
@options[:guess]
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
def strict
|
|
118
|
-
@options[:strict]
|
|
119
|
-
end
|
|
120
|
-
|
|
121
117
|
def wip?
|
|
122
118
|
@options[:wip]
|
|
123
119
|
end
|
|
@@ -285,6 +281,10 @@ module Cucumber
|
|
|
285
281
|
@id_generator ||= Cucumber::Messages::Helpers::IdGenerator::UUID.new
|
|
286
282
|
end
|
|
287
283
|
|
|
284
|
+
def retry_policy
|
|
285
|
+
@retry_policy ||= RetryPolicy.new(retry_attempts, retry_total_tests)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
288
|
def test_run_started_id
|
|
289
289
|
@test_run_started_id ||= id_generator.new_id
|
|
290
290
|
end
|
data/lib/cucumber/errors.rb
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
require 'cucumber/core/test/result'
|
|
4
4
|
|
|
5
5
|
module Cucumber
|
|
6
|
+
# Raised when a step matches 2 or more StepDefinitions
|
|
7
|
+
class Ambiguous < StandardError
|
|
8
|
+
def initialize(step_name, step_definitions, used_guess)
|
|
9
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
|
10
|
+
message = String.new
|
|
11
|
+
message << "Ambiguous match of \"#{step_name}\":\n\n"
|
|
12
|
+
message << step_definitions.map(&:backtrace_line).join("\n")
|
|
13
|
+
message << "\n\n"
|
|
14
|
+
message << "You can run again with --guess to make Cucumber be more smart about it\n" unless used_guess
|
|
15
|
+
super(message)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class FeatureFolderNotFoundException < RuntimeError
|
|
20
|
+
def initialize(path)
|
|
21
|
+
@path = path
|
|
22
|
+
super
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def message
|
|
26
|
+
"No such file or directory - #{@path}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class FileNotFoundException < RuntimeError
|
|
31
|
+
attr_reader :path
|
|
32
|
+
|
|
33
|
+
def initialize(original_exception, path)
|
|
34
|
+
@path = path
|
|
35
|
+
super(original_exception)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Raised when a StepDefinition's block invokes World#pending
|
|
40
|
+
class Pending < Core::Test::Result::Pending
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class TagExcess < StandardError
|
|
44
|
+
def initialize(messages)
|
|
45
|
+
super(messages.join("\n"))
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
6
49
|
# Raised when there is no matching StepDefinition for a step.
|
|
7
50
|
class Undefined < Core::Test::Result::Undefined
|
|
8
51
|
def self.from(result, step_name)
|
|
@@ -27,27 +70,4 @@ module Cucumber
|
|
|
27
70
|
super %(Undefined dynamic step: "#{step_name}")
|
|
28
71
|
end
|
|
29
72
|
end
|
|
30
|
-
|
|
31
|
-
# Raised when a StepDefinition's block invokes World#pending
|
|
32
|
-
class Pending < Core::Test::Result::Pending
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Raised when a step matches 2 or more StepDefinitions
|
|
36
|
-
class Ambiguous < StandardError
|
|
37
|
-
def initialize(step_name, step_definitions, used_guess)
|
|
38
|
-
# TODO: [LH] - Just use a heredoc here to fix this up
|
|
39
|
-
message = String.new
|
|
40
|
-
message << "Ambiguous match of \"#{step_name}\":\n\n"
|
|
41
|
-
message << step_definitions.map(&:backtrace_line).join("\n")
|
|
42
|
-
message << "\n\n"
|
|
43
|
-
message << "You can run again with --guess to make Cucumber be more smart about it\n" unless used_guess
|
|
44
|
-
super(message)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
class TagExcess < StandardError
|
|
49
|
-
def initialize(messages)
|
|
50
|
-
super(messages.join("\n"))
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
73
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cucumber
|
|
4
|
+
module Events
|
|
5
|
+
# Fired when attach is called in a step definition
|
|
6
|
+
class AttachCalled < Core::Event::Base
|
|
7
|
+
# The attachment body
|
|
8
|
+
attr_reader :src
|
|
9
|
+
|
|
10
|
+
# The content media type
|
|
11
|
+
attr_reader :media_type
|
|
12
|
+
|
|
13
|
+
# An optional filename
|
|
14
|
+
attr_reader :filename
|
|
15
|
+
|
|
16
|
+
def self.event_id
|
|
17
|
+
:attach_called
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(src, media_type, filename)
|
|
21
|
+
@src = src
|
|
22
|
+
@media_type = media_type
|
|
23
|
+
@filename = filename
|
|
24
|
+
super()
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Fired after we've parsed the contents of a feature file
|
|
8
|
-
class GherkinSourceParsed < Base
|
|
6
|
+
class GherkinSourceParsed < Core::Event::Base
|
|
9
7
|
# # The Gherkin Ast
|
|
10
8
|
attr_reader :gherkin_document
|
|
11
9
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Event fired when a step is created from a hook
|
|
8
|
-
class HookTestStepCreated < Base
|
|
6
|
+
class HookTestStepCreated < Core::Event::Base
|
|
9
7
|
attr_reader :test_step, :hook
|
|
10
8
|
|
|
11
9
|
def self.event_id
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Event fired after each step definition has been registered
|
|
8
|
-
class StepDefinitionRegistered < Base
|
|
6
|
+
class StepDefinitionRegistered < Core::Event::Base
|
|
9
7
|
# The step definition that was just registered.
|
|
10
8
|
# @return [RbSupport::RbStepDefinition]
|
|
11
9
|
attr_reader :step_definition
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Signals that a {Cucumber::Core::Test::Case} is about to be executed
|
|
8
|
-
class TestCaseStarted < Base
|
|
6
|
+
class TestCaseStarted < Core::Event::Base
|
|
9
7
|
# @return [Cucumber::Core::Test::Case] the test case to be executed
|
|
10
8
|
attr_reader :test_case
|
|
11
9
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Event fired once all test cases have been filtered before
|
|
8
6
|
# the first one is executed.
|
|
9
|
-
class TestRunStarted < Base
|
|
7
|
+
class TestRunStarted < Core::Event::Base
|
|
10
8
|
# @return [Array<Cucumber::Core::Test::Case>] the test cases to be executed
|
|
11
9
|
attr_reader :test_cases
|
|
12
10
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Event fired when a TestStep is created from a PickleStep
|
|
8
|
-
class TestStepCreated < Base
|
|
6
|
+
class TestStepCreated < Core::Event::Base
|
|
9
7
|
attr_reader :test_step, :pickle_step
|
|
10
8
|
|
|
11
9
|
def self.event_id
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Signals that a {Cucumber::Core::Test::Step} has finished executing
|
|
8
|
-
class TestStepFinished < Base
|
|
6
|
+
class TestStepFinished < Core::Event::Base
|
|
9
7
|
# @return [Cucumber::Core::Test::Step] the test step that was executed
|
|
10
8
|
attr_reader :test_step
|
|
11
9
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
|
|
5
3
|
module Cucumber
|
|
6
4
|
module Events
|
|
7
5
|
# Signals that a {Cucumber::Core::Test::Step} is about to be executed
|
|
8
|
-
class TestStepStarted < Base
|
|
6
|
+
class TestStepStarted < Core::Event::Base
|
|
9
7
|
# @return [Cucumber::Core::Test::Step] the test step to be executed
|
|
10
8
|
attr_reader :test_step
|
|
11
9
|
|
data/lib/cucumber/events.rb
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require 'cucumber/core/event/base'
|
|
4
|
+
|
|
5
|
+
Dir[File.join(__dir__, 'events', '*.rb')].each do |file|
|
|
6
|
+
require_relative File.join('events', File.basename(file))
|
|
7
|
+
end
|
|
4
8
|
|
|
5
9
|
module Cucumber
|
|
6
10
|
# Events tell you what's happening while Cucumber runs your features.
|
|
@@ -23,7 +27,8 @@ module Cucumber
|
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
def self.registry
|
|
26
|
-
Core::
|
|
30
|
+
Core::EventBus.build_registry(
|
|
31
|
+
AttachCalled,
|
|
27
32
|
GherkinSourceParsed,
|
|
28
33
|
GherkinSourceRead,
|
|
29
34
|
HookTestStepCreated,
|
|
@@ -7,16 +7,11 @@ require 'cucumber/events'
|
|
|
7
7
|
module Cucumber
|
|
8
8
|
module Filters
|
|
9
9
|
class Retry < Core::Filter.new(:configuration)
|
|
10
|
-
def initialize(*_args)
|
|
11
|
-
super
|
|
12
|
-
@total_permanently_failed = 0
|
|
13
|
-
end
|
|
14
|
-
|
|
15
10
|
def test_case(test_case)
|
|
16
11
|
configuration.on_event(:test_case_finished) do |event|
|
|
17
|
-
next unless
|
|
12
|
+
next unless event.test_case == test_case
|
|
13
|
+
next unless retry?(test_case, event.result)
|
|
18
14
|
|
|
19
|
-
test_case_counts[test_case] += 1
|
|
20
15
|
test_case.describe_to(receiver)
|
|
21
16
|
end
|
|
22
17
|
|
|
@@ -25,27 +20,17 @@ module Cucumber
|
|
|
25
20
|
|
|
26
21
|
private
|
|
27
22
|
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return false unless event.result.failed?
|
|
32
|
-
|
|
33
|
-
return false if @total_permanently_failed >= configuration.retry_total_tests
|
|
34
|
-
|
|
35
|
-
retry_required = test_case_counts[test_case] < configuration.retry_attempts
|
|
36
|
-
if retry_required
|
|
37
|
-
# retry test
|
|
23
|
+
def retry?(test_case, result)
|
|
24
|
+
if retry_policy.will_be_retried?(test_case, result)
|
|
25
|
+
retry_policy.record_retry(test_case)
|
|
38
26
|
true
|
|
39
27
|
else
|
|
40
|
-
|
|
41
|
-
@total_permanently_failed += 1
|
|
28
|
+
retry_policy.record_permanent_failure if result.failed?
|
|
42
29
|
false
|
|
43
30
|
end
|
|
44
31
|
end
|
|
45
32
|
|
|
46
|
-
def
|
|
47
|
-
@test_case_counts ||= Hash.new { |h, k| h[k] = 0 }
|
|
48
|
-
end
|
|
33
|
+
def retry_policy = configuration.retry_policy
|
|
49
34
|
end
|
|
50
35
|
end
|
|
51
36
|
end
|
|
@@ -169,15 +169,15 @@ module Cucumber
|
|
|
169
169
|
end
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
-
def
|
|
173
|
-
return unless media_type == 'text/x.cucumber.log+plain'
|
|
172
|
+
def on_attach_called(event)
|
|
173
|
+
return unless event.media_type == 'text/x.cucumber.log+plain'
|
|
174
174
|
return unless @io
|
|
175
175
|
|
|
176
176
|
@io.puts
|
|
177
|
-
if filename
|
|
178
|
-
@io.puts("#{filename}: #{format_string(src, :tag)}")
|
|
177
|
+
if event.filename
|
|
178
|
+
@io.puts("#{event.filename}: #{format_string(event.src, :tag)}")
|
|
179
179
|
else
|
|
180
|
-
@io.puts(format_string(src, :tag))
|
|
180
|
+
@io.puts(format_string(event.src, :tag))
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
@io.flush
|
|
@@ -31,9 +31,11 @@ module Cucumber
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def status_counts(summary)
|
|
34
|
-
counts =
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
counts =
|
|
35
|
+
Cucumber::Core::Test::Result::BooleanMethods::TYPES
|
|
36
|
+
.map { |status| [status, summary.total(status)] }
|
|
37
|
+
.select { |_status, count| count.positive? }
|
|
38
|
+
.map { |status, count| format_string("#{count} #{status}", status) }
|
|
37
39
|
"(#{counts.join(', ')})" if counts.any?
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -15,9 +15,9 @@ module Cucumber
|
|
|
15
15
|
@config.on_event(:test_case_finished) do |event|
|
|
16
16
|
if event.test_case != @previous_test_case
|
|
17
17
|
@previous_test_case = event.test_case
|
|
18
|
-
@issues[event.result.to_sym] << event.test_case unless event.result.ok?
|
|
18
|
+
@issues[event.result.to_sym] << event.test_case unless event.result.ok?
|
|
19
19
|
elsif event.result.passed?
|
|
20
|
-
@issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?
|
|
20
|
+
@issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?
|
|
21
21
|
@issues[:failed].delete(event.test_case)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -25,7 +25,7 @@ module Cucumber
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def to_s
|
|
28
|
-
test_case_result = @issues.empty? ? [] : Core::Test::Result::TYPES.map { |type| scenario_listing(type, @issues[type]) }
|
|
28
|
+
test_case_result = @issues.empty? ? [] : Cucumber::Core::Test::Result::BooleanMethods::TYPES.map { |type| scenario_listing(type, @issues[type]) }
|
|
29
29
|
global_hooks_result = @global_hooks_summary.ok? ? [] : @global_hooks_summary.exception_listing
|
|
30
30
|
[test_case_result + global_hooks_result].flatten.join("\n")
|
|
31
31
|
end
|
|
@@ -8,10 +8,10 @@ module Cucumber
|
|
|
8
8
|
class FailFast
|
|
9
9
|
def initialize(configuration)
|
|
10
10
|
@previous_test_case = nil
|
|
11
|
-
configuration.on_event
|
|
11
|
+
configuration.on_event(:test_case_finished) do |event|
|
|
12
12
|
if event.test_case != @previous_test_case
|
|
13
13
|
@previous_test_case = event.test_case
|
|
14
|
-
Cucumber.wants_to_quit = true unless event.result.ok?
|
|
14
|
+
Cucumber.wants_to_quit = true unless event.result.ok?
|
|
15
15
|
elsif event.result.passed?
|
|
16
16
|
Cucumber.wants_to_quit = false
|
|
17
17
|
end
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'cucumber/formatter/io'
|
|
4
3
|
require 'cucumber/html_formatter'
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
require_relative 'io'
|
|
6
6
|
|
|
7
7
|
module Cucumber
|
|
8
8
|
module Formatter
|
|
9
|
-
class HTML
|
|
9
|
+
class HTML
|
|
10
|
+
include Io
|
|
11
|
+
|
|
10
12
|
def initialize(config)
|
|
13
|
+
@config = config
|
|
11
14
|
@io = ensure_io(config.out_stream, config.error_stream)
|
|
12
15
|
@html_formatter = Cucumber::HTMLFormatter::Formatter.new(@io)
|
|
13
16
|
@html_formatter.write_pre_message
|
|
14
|
-
|
|
17
|
+
config.on_event :envelope, &method(:on_envelope)
|
|
15
18
|
end
|
|
16
19
|
|
|
17
|
-
def
|
|
18
|
-
|
|
20
|
+
def on_envelope(event)
|
|
21
|
+
envelope = event.envelope
|
|
19
22
|
@html_formatter.write_message(envelope)
|
|
23
|
+
# TODO: Move this conditional logic into the HTML formatter proper
|
|
20
24
|
@html_formatter.write_post_message if envelope.test_run_finished
|
|
21
25
|
end
|
|
22
26
|
end
|