flatware-cucumber 0.4.1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +38 -47
- data/lib/flatware/cucumber.rb +51 -0
- data/lib/flatware/cucumber/cli.rb +33 -9
- data/lib/flatware/cucumber/formatter.rb +24 -15
- data/lib/flatware/cucumber/formatters/console.rb +49 -41
- data/lib/flatware/cucumber/formatters/console/summary.rb +65 -47
- data/lib/flatware/cucumber/result.rb +2 -2
- data/lib/flatware/cucumber/runtime.rb +10 -7
- data/lib/flatware/cucumber/step_result.rb +6 -4
- metadata +24 -22
- data/lib/flatware/cucumber/scenario_result.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2477f63249ef4e47d3159dfacb20e2546dce34ada66424440a79de5702e1cd4b
|
4
|
+
data.tar.gz: 39dc97908abff2986ae22b4d96d9adbcebb163c26ab2613b7dab7628ce2c0f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc988bd7c0b4d8017cfb211cfc53f8eaeb05359b1cb794ebead403c4dbce57c9a3b7227853667970dc8252255e05784b21bcc93b4b1bb591434028607debfb7
|
7
|
+
data.tar.gz: f05e661d89b19f9d092e6f9ed8f3b7d9c6a1b12ab3fcc52c37e5e891480ad69e698866859c62847390f5b684c8bda37d61062472bf419ca644a8ee0acd4d3bef
|
data/README.md
CHANGED
@@ -7,39 +7,6 @@
|
|
7
7
|
|
8
8
|
Flatware parallelizes your test suite to significantly reduce test time.
|
9
9
|
|
10
|
-
## Requirements
|
11
|
-
|
12
|
-
* ZeroMQ > 4.0
|
13
|
-
|
14
|
-
## Installation
|
15
|
-
|
16
|
-
### ZeroMQ
|
17
|
-
|
18
|
-
#### Linux Ubuntu
|
19
|
-
|
20
|
-
```sh
|
21
|
-
sudo apt-get install -qq libzmq3-dev
|
22
|
-
```
|
23
|
-
|
24
|
-
(Never you mind the 3. This package contains ZMQ version 4.)
|
25
|
-
|
26
|
-
#### Mac OSX
|
27
|
-
|
28
|
-
|
29
|
-
If you're on macOS 10.12, use the custom hashrocket ZMQ homebrew formula.
|
30
|
-
|
31
|
-
```sh
|
32
|
-
brew tap hashrocket/formulas
|
33
|
-
brew install hashrocket/formulas/zeromq
|
34
|
-
```
|
35
|
-
|
36
|
-
The stock homebrew version will likely work on older versions of macOS.
|
37
|
-
|
38
|
-
|
39
|
-
```sh
|
40
|
-
brew install zeromq
|
41
|
-
```
|
42
|
-
|
43
10
|
### Flatware
|
44
11
|
|
45
12
|
Add the runners you need to your Gemfile:
|
@@ -73,6 +40,18 @@ To run your entire suite with the default rspec options add the `flatware-rspec`
|
|
73
40
|
$ flatware rspec
|
74
41
|
```
|
75
42
|
|
43
|
+
The rspec runner can balance worker loads, making your suite even faster.
|
44
|
+
|
45
|
+
It forms balaced groups of spec files according to their last run times, if you've set `example_status_persistence_file_path` [in your RSpec config](https://relishapp.com/rspec/rspec-core/v/3-8/docs/command-line/only-failures).
|
46
|
+
|
47
|
+
For this to work the configuration option must be loaded before any specs are run. The `.rspec` file is one way to achive this:
|
48
|
+
|
49
|
+
--require spec_helper
|
50
|
+
|
51
|
+
But beware, if you're using ActiveRecord in your suite you'll need to avoid doing things that cause it to establish a database connection in `spec_helper.rb`. If ActiveRecord connects before flatware forks off workers, each will die messily. All of this will just work if you're following [the recomended pattern of splitting your helpers into `spec_helper` and `rails_helper`](https://github.com/rspec/rspec-rails/blob/v3.8.2/lib/generators/rspec/install/templates/spec/rails_helper.rb). Another option is to use [the configurable hooks](
|
52
|
+
#faster-startup-with-activerecord
|
53
|
+
).
|
54
|
+
|
76
55
|
### Options
|
77
56
|
|
78
57
|
If you'd like to limit the number of forked workers, you can pass the 'w' flag:
|
@@ -85,7 +64,7 @@ You can also pass most cucumber/rspec options to Flatware. For example, to run o
|
|
85
64
|
features that are not tagged 'javascript', you can:
|
86
65
|
|
87
66
|
```sh
|
88
|
-
$ flatware cucumber -t
|
67
|
+
$ flatware cucumber -t 'not @javascript'
|
89
68
|
```
|
90
69
|
|
91
70
|
Additionally, for either cucumber or rspec you can specify a directory:
|
@@ -123,9 +102,31 @@ Now you are ready to rock:
|
|
123
102
|
$ flatware rspec && flatware cucumber
|
124
103
|
```
|
125
104
|
|
126
|
-
|
105
|
+
### Faster Startup With ActiveRecord
|
127
106
|
|
128
|
-
|
107
|
+
Flatware has a couple lifecycle callbacks that you can use to avoid booting your app
|
108
|
+
over again on every core. One way to take advantage of this via a `spec/flatware_helper.rb` file like so:
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
Flatware.configure do |conf|
|
112
|
+
conf.before_fork do
|
113
|
+
require 'rails_helper'
|
114
|
+
|
115
|
+
ActiveRecord::Base.connection.disconnect!
|
116
|
+
end
|
117
|
+
|
118
|
+
conf.after_fork do |test_env_number|
|
119
|
+
config = ActiveRecord::Base.connection_config
|
120
|
+
|
121
|
+
ActiveRecord::Base.establish_connection(
|
122
|
+
config.merge(
|
123
|
+
database: config.fetch(:database) + test_env_number.to_s
|
124
|
+
)
|
125
|
+
)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
```
|
129
|
+
Now when I run `bundle exec flatware rspec -r ./spec/flatware_helper` My app only boots once, rather than once per core.
|
129
130
|
|
130
131
|
## Design Goals
|
131
132
|
|
@@ -156,20 +157,10 @@ directory. CD there and `flatware` will be in your path so you can tinker away.
|
|
156
157
|
|
157
158
|
## How it works
|
158
159
|
|
159
|
-
Flatware relies on a message passing system to enable concurrency.
|
160
|
-
The main process declares a worker for each cpu in the computer. Each
|
161
|
-
worker forks from the main process and is then assigned a portion of the
|
162
|
-
test suite. As the worker runs the test suite it sends progress
|
163
|
-
messages to the main process. These messages are collected and when
|
164
|
-
the last worker is finished the main process provides a report on the
|
165
|
-
collected progress messages.
|
160
|
+
Flatware relies on a message passing system to enable concurrency. The main process forks a worker for each cpu in the computer. These workers are each given a chunk of the tests to run. The workers report back to the main process about their progress. The main process prints those progress messages. When the last worker is finished the main process prints the results.
|
166
161
|
|
167
162
|
## Resources
|
168
163
|
|
169
|
-
To learn more about the messaging system that Flatware uses, take a look at the
|
170
|
-
[excellent ZeroMQ guide][z].
|
171
|
-
|
172
|
-
[z]: http://zguide.zeromq.org/page:all
|
173
164
|
[a]: https://github.com/cucumber/aruba
|
174
165
|
|
175
166
|
## Contributing to Flatware
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
require 'flatware/cucumber/formatter'
|
3
|
+
require 'flatware/cucumber/result'
|
4
|
+
require 'flatware/cucumber/step_result'
|
5
|
+
require 'flatware/cucumber/formatters/console'
|
6
|
+
require 'flatware/cucumber/cli'
|
7
|
+
|
8
|
+
module Flatware
|
9
|
+
module Cucumber
|
10
|
+
class Config
|
11
|
+
attr_reader :config, :args
|
12
|
+
|
13
|
+
def initialize(cucumber_config, args)
|
14
|
+
@config = cucumber_config
|
15
|
+
@args = args
|
16
|
+
end
|
17
|
+
|
18
|
+
def feature_dir
|
19
|
+
@config.feature_dirs.first
|
20
|
+
end
|
21
|
+
|
22
|
+
def jobs
|
23
|
+
feature_files.map { |file| Job.new file, args }.to_a
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def feature_files
|
29
|
+
config.feature_files - config.feature_dirs
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module_function
|
34
|
+
|
35
|
+
def configure(args, out_stream = $stdout, error_stream = $stderr)
|
36
|
+
raw_args = args.dup
|
37
|
+
cli_config = ::Cucumber::Cli::Configuration.new(out_stream, error_stream)
|
38
|
+
cli_config.parse! args + %w[--format Flatware::Cucumber::Formatter]
|
39
|
+
cucumber_config = ::Cucumber::Configuration.new cli_config
|
40
|
+
Config.new cucumber_config, raw_args
|
41
|
+
end
|
42
|
+
|
43
|
+
def run(feature_files, options)
|
44
|
+
runtime(Array(feature_files) + options).run!
|
45
|
+
end
|
46
|
+
|
47
|
+
def runtime(args)
|
48
|
+
::Cucumber::Runtime.new(configure(args).config)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,22 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'flatware/cli'
|
2
4
|
|
3
5
|
module Flatware
|
6
|
+
# cucumber thor command
|
4
7
|
class CLI
|
5
8
|
worker_option
|
6
|
-
method_option
|
7
|
-
|
8
|
-
|
9
|
+
method_option(
|
10
|
+
'sink-endpoint',
|
11
|
+
type: :string,
|
12
|
+
default: 'drbunix:sink'
|
13
|
+
)
|
14
|
+
desc(
|
15
|
+
'cucumber [FLATWARE_OPTS] [CUCUMBER_ARGS]',
|
16
|
+
'parallelizes cucumber with custom arguments'
|
17
|
+
)
|
9
18
|
def cucumber(*args)
|
10
19
|
config = Cucumber.configure args
|
11
20
|
|
12
|
-
|
13
|
-
puts "Please create some feature files in the #{config.feature_dir} directory."
|
14
|
-
exit 1
|
15
|
-
end
|
21
|
+
ensure_jobs(config)
|
16
22
|
|
17
23
|
Flatware.verbose = options[:log]
|
18
|
-
|
19
|
-
|
24
|
+
sink = options['sink-endpoint']
|
25
|
+
Worker.spawn(count: workers, runner: Cucumber, sink: sink)
|
26
|
+
start_sink(
|
27
|
+
jobs: config.jobs,
|
28
|
+
workers: workers,
|
29
|
+
formatter: Flatware::Cucumber::Formatters::Console.new($stdout, $stderr)
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def ensure_jobs(config)
|
36
|
+
return if config.jobs.any?
|
37
|
+
|
38
|
+
abort(
|
39
|
+
format(
|
40
|
+
'Please create some feature files in the %<dir>s directory.',
|
41
|
+
dir: config.feature_dir
|
42
|
+
)
|
43
|
+
)
|
20
44
|
end
|
21
45
|
end
|
22
46
|
end
|
@@ -6,7 +6,7 @@ module Flatware
|
|
6
6
|
class Formatter
|
7
7
|
Checkpoint = Struct.new :steps, :scenarios do
|
8
8
|
def failures?
|
9
|
-
scenarios.any?
|
9
|
+
scenarios.any?(&:failed?)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -21,10 +21,11 @@ module Flatware
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def initialize(config)
|
24
|
-
|
25
|
-
config.on_event :
|
26
|
-
config.on_event :
|
27
|
-
config.on_event :
|
24
|
+
# FIXME: can we sneak the sink in through the config?
|
25
|
+
config.on_event :test_case_finished, &method(:on_test_case_finished)
|
26
|
+
config.on_event :test_step_finished, &method(:on_test_step_finished)
|
27
|
+
config.on_event :test_run_finished, &method(:on_test_run_finished)
|
28
|
+
config.on_event :step_activated, &method(:on_step_activated)
|
28
29
|
reset
|
29
30
|
end
|
30
31
|
|
@@ -38,23 +39,31 @@ module Flatware
|
|
38
39
|
|
39
40
|
attr_reader :steps, :scenarios, :matched_steps
|
40
41
|
|
41
|
-
def
|
42
|
-
scenarios << Scenario.new(
|
42
|
+
def on_test_case_finished(event)
|
43
|
+
scenarios << Scenario.new(
|
44
|
+
event.test_case.name,
|
45
|
+
event.test_case.location.to_s,
|
46
|
+
event.result.to_sym
|
47
|
+
)
|
43
48
|
end
|
44
49
|
|
45
|
-
def
|
50
|
+
def on_step_activated(event)
|
46
51
|
@matched_steps << event.step_match.location.to_s
|
47
52
|
end
|
48
53
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
+
def on_test_step_finished(event)
|
55
|
+
result = event.result
|
56
|
+
return unless really_a_step?(event.test_step) || result.undefined?
|
57
|
+
|
58
|
+
steps << StepResult.new(
|
59
|
+
result.to_sym,
|
60
|
+
result.failed? && result.exception
|
61
|
+
)
|
62
|
+
Sink.client.progress Result.new result.to_sym
|
54
63
|
end
|
55
64
|
|
56
|
-
def
|
57
|
-
Sink
|
65
|
+
def on_test_run_finished(*)
|
66
|
+
Sink.client.checkpoint Checkpoint.new steps, scenarios
|
58
67
|
reset
|
59
68
|
end
|
60
69
|
|
@@ -1,48 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'flatware/cucumber/formatters/console/summary'
|
2
4
|
require 'cucumber/formatter/console'
|
3
5
|
|
4
|
-
module Flatware
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
6
|
+
module Flatware
|
7
|
+
module Cucumber
|
8
|
+
module Formatters
|
9
|
+
class Console
|
10
|
+
# for format_string
|
11
|
+
include ::Cucumber::Formatter::Console
|
12
|
+
|
13
|
+
FORMATS = {
|
14
|
+
passed: '.',
|
15
|
+
failed: 'F',
|
16
|
+
undefined: 'U',
|
17
|
+
pending: 'P',
|
18
|
+
skipped: '-'
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
STATUSES = FORMATS.keys
|
22
|
+
|
23
|
+
attr_reader :out, :err
|
24
|
+
|
25
|
+
def initialize(stdout, stderr)
|
26
|
+
@out = stdout
|
27
|
+
@err = stderr
|
28
|
+
end
|
29
|
+
|
30
|
+
def progress(result)
|
31
|
+
out.print format result.progress
|
32
|
+
end
|
33
|
+
|
34
|
+
def summarize(checkpoints)
|
35
|
+
steps = checkpoints.flat_map(&:steps)
|
36
|
+
scenarios = checkpoints.flat_map(&:scenarios)
|
37
|
+
Summary.new(steps, scenarios, out).summarize
|
38
|
+
end
|
39
|
+
|
40
|
+
def summarize_remaining(remaining_jobs)
|
41
|
+
out.puts
|
42
|
+
out.puts 'The following features have not been run:'
|
43
|
+
remaining_jobs.each do |job|
|
44
|
+
out.puts job.id
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def format(status)
|
51
|
+
format_string FORMATS[status], status
|
52
|
+
end
|
40
53
|
end
|
41
54
|
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def format(status)
|
45
|
-
format_string FORMATS[status], status
|
46
|
-
end
|
47
55
|
end
|
48
56
|
end
|
@@ -1,64 +1,82 @@
|
|
1
1
|
require 'cucumber/formatter/console'
|
2
2
|
require 'flatware/cucumber/formatters/console'
|
3
3
|
|
4
|
-
module Flatware
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
module Flatware
|
5
|
+
module Cucumber
|
6
|
+
module Formatters
|
7
|
+
class Console
|
8
|
+
class Summary
|
9
|
+
include ::Cucumber::Formatter::Console
|
10
|
+
attr_reader :io, :steps, :scenarios
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def initialize(steps, scenarios = [], io = StringIO.new)
|
13
|
+
@io = io
|
14
|
+
@steps = steps
|
15
|
+
@scenarios = scenarios
|
16
|
+
end
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def summarize
|
19
|
+
2.times { io.puts }
|
20
|
+
print_failures(steps, 'step')
|
21
|
+
print_failures(scenarios.select(&:failed_outside_step?), 'scenario')
|
22
|
+
print_failed_scenarios scenarios
|
23
|
+
print_counts 'scenario', scenarios
|
24
|
+
print_counts 'step', steps
|
25
|
+
end
|
24
26
|
|
25
|
-
|
27
|
+
private
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
def print_failed_scenarios(scenarios)
|
30
|
+
failed_scenarios = scenarios.select(&with_status(:failed))
|
31
|
+
return if failed_scenarios.empty?
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
io.puts format_string 'Failing Scenarios:', :failed
|
34
|
+
failed_scenarios
|
35
|
+
.sort_by(&:file_colon_line)
|
36
|
+
.map(&method(:to_failed_scenario_line))
|
37
|
+
.each(&io.method(:puts))
|
38
|
+
io.puts
|
39
|
+
end
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
+
def to_failed_scenario_line(scenario)
|
42
|
+
[
|
43
|
+
[scenario.file_colon_line, :failed],
|
44
|
+
["# Scenario: #{scenario.name}", :comment]
|
45
|
+
].map do |string, format|
|
46
|
+
format_string string, format
|
47
|
+
end.join(' ')
|
48
|
+
end
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
|
50
|
+
def print_failures(collection, label)
|
51
|
+
failures = collection.select(&with_status(:failed))
|
52
|
+
print_elements failures, :failed, pluralize(label, failures.size)
|
53
|
+
end
|
45
54
|
|
46
|
-
|
47
|
-
|
48
|
-
|
55
|
+
def print_counts(label, collection)
|
56
|
+
io.puts(
|
57
|
+
pluralize(label, collection.size) + count_summary(collection)
|
58
|
+
)
|
59
|
+
end
|
49
60
|
|
50
|
-
|
51
|
-
|
52
|
-
|
61
|
+
def pluralize(word, number)
|
62
|
+
"#{number} #{number == 1 ? word : "#{word}s"}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def with_status(status)
|
66
|
+
proc { |r| r.status == status }
|
67
|
+
end
|
53
68
|
|
54
|
-
|
55
|
-
|
56
|
-
status_counts = STATUSES.map do |status|
|
57
|
-
count = results.select(&with_status(status)).size
|
58
|
-
format_string "#{count} #{status}", status if count > 0
|
59
|
-
end.compact.join ", "
|
69
|
+
def count_summary(results)
|
70
|
+
return '' unless results.any?
|
60
71
|
|
61
|
-
|
72
|
+
status_counts = STATUSES.map do |status|
|
73
|
+
count = results.select(&with_status(status)).size
|
74
|
+
format_string "#{count} #{status}", status if count.positive?
|
75
|
+
end.compact.join ', '
|
76
|
+
|
77
|
+
" (#{status_counts})"
|
78
|
+
end
|
79
|
+
end
|
62
80
|
end
|
63
81
|
end
|
64
82
|
end
|
@@ -5,12 +5,12 @@ module Flatware
|
|
5
5
|
|
6
6
|
def initialize(progress)
|
7
7
|
@progress = progress
|
8
|
-
@worker = ENV
|
8
|
+
@worker = ENV.fetch('TEST_ENV_NUMBER', 0).to_i
|
9
9
|
end
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def step(*args)
|
13
|
-
step = StepResult.new
|
13
|
+
step = StepResult.new(*args)
|
14
14
|
new step.progress, [step]
|
15
15
|
end
|
16
16
|
|
@@ -3,13 +3,12 @@ require 'cucumber'
|
|
3
3
|
module Flatware
|
4
4
|
module Cucumber
|
5
5
|
class Runtime < ::Cucumber::Runtime
|
6
|
-
|
7
6
|
attr_accessor :configuration, :loader
|
8
|
-
attr_reader :out, :err
|
9
|
-
attr_reader :visitor
|
7
|
+
attr_reader :out, :err, :visitor
|
10
8
|
|
11
|
-
def initialize(out=StringIO.new, err=out)
|
12
|
-
@out
|
9
|
+
def initialize(out = StringIO.new, err = out)
|
10
|
+
@out = out
|
11
|
+
@err = err
|
13
12
|
super(default_configuration)
|
14
13
|
load_step_definitions
|
15
14
|
@results = Results.new(configuration)
|
@@ -21,9 +20,13 @@ module Flatware
|
|
21
20
|
config
|
22
21
|
end
|
23
22
|
|
24
|
-
def run(feature_files=[], options=[])
|
23
|
+
def run(feature_files = [], options = [])
|
25
24
|
@loader = nil
|
26
|
-
options =
|
25
|
+
options = [
|
26
|
+
Array(feature_files),
|
27
|
+
%w[--format Flatware::Cucumber::Formatter],
|
28
|
+
options
|
29
|
+
].reduce(:+)
|
27
30
|
|
28
31
|
configure(::Cucumber::Cli::Main.new(options, out, err).configuration)
|
29
32
|
|
@@ -5,7 +5,8 @@ module Flatware
|
|
5
5
|
attr_reader :status, :exception
|
6
6
|
|
7
7
|
def initialize(status, exception)
|
8
|
-
@status
|
8
|
+
@status = status
|
9
|
+
@exception = (serialized(exception) if exception)
|
9
10
|
end
|
10
11
|
|
11
12
|
def passed?
|
@@ -21,9 +22,10 @@ module Flatware
|
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
def serialized(err)
|
27
|
+
err.backtrace&.unshift(err.backtrace.shift.sub(Dir.pwd, '.'))
|
28
|
+
SerializedException.new(err.class, err.message, err.backtrace)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatware-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Dunn
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: cucumber
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: flatware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.0.rc2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.0.rc2
|
41
41
|
description: A distributed cucumber runner
|
42
42
|
email: brian@hashrocket.com
|
43
43
|
executables: []
|
@@ -49,36 +49,38 @@ files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
- lib/flatware-cucumber.rb
|
52
|
+
- lib/flatware/cucumber.rb
|
52
53
|
- lib/flatware/cucumber/cli.rb
|
53
54
|
- lib/flatware/cucumber/formatter.rb
|
54
55
|
- lib/flatware/cucumber/formatters/console.rb
|
55
56
|
- lib/flatware/cucumber/formatters/console/summary.rb
|
56
57
|
- lib/flatware/cucumber/result.rb
|
57
58
|
- lib/flatware/cucumber/runtime.rb
|
58
|
-
- lib/flatware/cucumber/scenario_result.rb
|
59
59
|
- lib/flatware/cucumber/step_result.rb
|
60
60
|
homepage: http://github.com/briandunn/flatware
|
61
61
|
licenses:
|
62
62
|
- MIT
|
63
63
|
metadata: {}
|
64
|
-
post_install_message:
|
64
|
+
post_install_message:
|
65
65
|
rdoc_options: []
|
66
66
|
require_paths:
|
67
67
|
- lib
|
68
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- - "
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2.6'
|
73
|
+
- - "<"
|
71
74
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
75
|
+
version: '3.1'
|
73
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
77
|
requirements:
|
75
|
-
- - "
|
78
|
+
- - ">"
|
76
79
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
80
|
+
version: 1.3.1
|
78
81
|
requirements: []
|
79
|
-
|
80
|
-
|
81
|
-
signing_key:
|
82
|
+
rubygems_version: 3.2.3
|
83
|
+
signing_key:
|
82
84
|
specification_version: 4
|
83
85
|
summary: A distributed cucumber runner
|
84
86
|
test_files: []
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'flatware/serialized_exception'
|
2
|
-
module Flatware
|
3
|
-
module Cucumber
|
4
|
-
class ScenarioResult
|
5
|
-
attr_reader :status, :file_colon_line, :name
|
6
|
-
def initialize(status, file_colon_line, name, e)
|
7
|
-
@status = status
|
8
|
-
@file_colon_line = file_colon_line
|
9
|
-
@name = name
|
10
|
-
@exception = SerializedException.new(e.class, e.message, e.backtrace) if e
|
11
|
-
@failed_outside_step = false
|
12
|
-
end
|
13
|
-
|
14
|
-
def passed?
|
15
|
-
status == :passed
|
16
|
-
end
|
17
|
-
|
18
|
-
def failed?
|
19
|
-
status == :failed
|
20
|
-
end
|
21
|
-
|
22
|
-
def failed_outside_step!(file_colon_line)
|
23
|
-
@failed_outside_step = file_colon_line
|
24
|
-
end
|
25
|
-
|
26
|
-
def failed_outside_step?
|
27
|
-
!!@failed_outside_step
|
28
|
-
end
|
29
|
-
|
30
|
-
def exception
|
31
|
-
@exception.tap do |e|
|
32
|
-
e.backtrace = e.backtrace.grep(Regexp.new(Dir.pwd)).map { |line| line[Dir.pwd.size..-1] }
|
33
|
-
e.backtrace = e.backtrace + [@failed_outside_step] if failed_outside_step?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|