flatware 0.4.0 → 2.0.0.rc1
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 +5 -5
- data/README.md +40 -42
- data/bin/flatware +2 -2
- data/lib/flatware.rb +33 -3
- data/lib/flatware/broadcaster.rb +20 -3
- data/lib/flatware/cli.rb +45 -21
- data/lib/flatware/configuration.rb +40 -0
- data/lib/flatware/job.rb +22 -0
- data/lib/flatware/pid.rb +41 -0
- data/lib/flatware/serialized_exception.rb +16 -4
- data/lib/flatware/sink.rb +97 -65
- data/lib/flatware/sink/client.rb +7 -5
- data/lib/flatware/version.rb +3 -1
- data/lib/flatware/worker.rb +50 -31
- metadata +21 -82
- data/lib/flatware-cucumber.rb +0 -1
- data/lib/flatware-rspec.rb +0 -1
- data/lib/flatware/cucumber.rb +0 -51
- data/lib/flatware/cucumber/checkpoint.rb +0 -28
- data/lib/flatware/cucumber/cli.rb +0 -22
- data/lib/flatware/cucumber/formatter.rb +0 -66
- data/lib/flatware/cucumber/formatters/console.rb +0 -48
- data/lib/flatware/cucumber/formatters/console/summary.rb +0 -66
- data/lib/flatware/cucumber/result.rb +0 -27
- data/lib/flatware/cucumber/runtime.rb +0 -36
- data/lib/flatware/cucumber/scenario_result.rb +0 -38
- data/lib/flatware/cucumber/step_result.rb +0 -30
- data/lib/flatware/pids.rb +0 -25
- data/lib/flatware/poller.rb +0 -35
- data/lib/flatware/processor_info.rb +0 -24
- data/lib/flatware/rspec.rb +0 -28
- data/lib/flatware/rspec/checkpoint.rb +0 -29
- data/lib/flatware/rspec/cli.rb +0 -16
- data/lib/flatware/rspec/example_notification.rb +0 -21
- data/lib/flatware/rspec/examples_notification.rb +0 -24
- data/lib/flatware/rspec/formatter.rb +0 -50
- data/lib/flatware/rspec/formatters/console.rb +0 -33
- data/lib/flatware/rspec/summary.rb +0 -40
- data/lib/flatware/socket.rb +0 -181
data/lib/flatware-cucumber.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'flatware/cucumber'
|
data/lib/flatware-rspec.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'flatware/rspec'
|
data/lib/flatware/cucumber.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'cucumber'
|
2
|
-
require 'flatware/cucumber/checkpoint'
|
3
|
-
require 'flatware/cucumber/formatter'
|
4
|
-
require 'flatware/cucumber/result'
|
5
|
-
require 'flatware/cucumber/scenario_result'
|
6
|
-
require 'flatware/cucumber/step_result'
|
7
|
-
require 'flatware/cucumber/formatters/console'
|
8
|
-
require 'flatware/cucumber/cli'
|
9
|
-
|
10
|
-
module Flatware
|
11
|
-
module Cucumber
|
12
|
-
class Config
|
13
|
-
attr_reader :config, :args
|
14
|
-
def initialize(cucumber_config, args)
|
15
|
-
@config, @args = cucumber_config, 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
|
-
extend self
|
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,28 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
module Cucumber
|
3
|
-
class Checkpoint
|
4
|
-
attr_reader :steps, :scenarios
|
5
|
-
def initialize(steps, scenarios)
|
6
|
-
@steps, @scenarios = serialize_steps(steps), serialize_scenarios(scenarios)
|
7
|
-
end
|
8
|
-
|
9
|
-
def failures?
|
10
|
-
scenarios.any? &:failed?
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def serialize_steps(steps)
|
16
|
-
steps.map do |step|
|
17
|
-
StepResult.new step.status, step.exception
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def serialize_scenarios(scenarios)
|
22
|
-
scenarios.map do |scenario|
|
23
|
-
ScenarioResult.new scenario.status, scenario.file_colon_line, scenario.name, scenario.exception
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'flatware/cli'
|
2
|
-
|
3
|
-
module Flatware
|
4
|
-
class CLI
|
5
|
-
worker_option
|
6
|
-
method_option 'dispatch-endpoint', type: :string, default: 'ipc://dispatch'
|
7
|
-
method_option 'sink-endpoint', type: :string, default: 'ipc://task'
|
8
|
-
desc "cucumber [FLATWARE_OPTS] [CUCUMBER_ARGS]", "parallelizes cucumber with custom arguments"
|
9
|
-
def cucumber(*args)
|
10
|
-
config = Cucumber.configure args
|
11
|
-
|
12
|
-
unless config.jobs.any?
|
13
|
-
puts "Please create some feature files in the #{config.feature_dir} directory."
|
14
|
-
exit 1
|
15
|
-
end
|
16
|
-
|
17
|
-
Flatware.verbose = options[:log]
|
18
|
-
Worker.spawn count: workers, runner: Cucumber, dispatch: options['dispatch-endpoint'], sink: options['sink-endpoint']
|
19
|
-
start_sink jobs: config.jobs, workers: workers, formatter: Flatware::Cucumber::Formatters::Console.new($stdout, $stderr)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'cucumber'
|
2
|
-
require 'flatware/sink'
|
3
|
-
require 'ostruct'
|
4
|
-
module Flatware
|
5
|
-
module Cucumber
|
6
|
-
class Formatter
|
7
|
-
Checkpoint = Struct.new :steps, :scenarios do
|
8
|
-
def failures?
|
9
|
-
scenarios.any? &:failed?
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Scenario = Struct.new :name, :file_colon_line, :status do
|
14
|
-
def failed?
|
15
|
-
status == :failed
|
16
|
-
end
|
17
|
-
|
18
|
-
def failed_outside_step?
|
19
|
-
false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(config)
|
24
|
-
config.on_event :after_test_case, &method(:on_after_test_case)
|
25
|
-
config.on_event :after_test_step, &method(:on_after_test_step)
|
26
|
-
config.on_event :finished_testing, &method(:on_finished_testing)
|
27
|
-
config.on_event :step_match, &method(:on_step_match)
|
28
|
-
reset
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def reset
|
34
|
-
@steps = []
|
35
|
-
@scenarios = []
|
36
|
-
@matched_steps = Set.new
|
37
|
-
end
|
38
|
-
|
39
|
-
attr_reader :steps, :scenarios, :matched_steps
|
40
|
-
|
41
|
-
def on_after_test_case(event)
|
42
|
-
scenarios << Scenario.new(event.test_case.name, event.test_case.location.to_s, event.result.to_sym)
|
43
|
-
end
|
44
|
-
|
45
|
-
def on_step_match(event)
|
46
|
-
@matched_steps << event.step_match.location.to_s
|
47
|
-
end
|
48
|
-
|
49
|
-
def on_after_test_step(event)
|
50
|
-
if really_a_step?(event.test_step) or event.result.undefined?
|
51
|
-
steps << StepResult.new(event.result.to_sym, event.result.failed? && event.result.exception)
|
52
|
-
Sink::client.progress Result.new event.result.to_sym
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def on_finished_testing(*)
|
57
|
-
Sink::client.checkpoint Checkpoint.new steps, scenarios
|
58
|
-
reset
|
59
|
-
end
|
60
|
-
|
61
|
-
def really_a_step?(step)
|
62
|
-
matched_steps.include?(step.action_location.to_s)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'flatware/cucumber/formatters/console/summary'
|
2
|
-
require 'cucumber/formatter/console'
|
3
|
-
|
4
|
-
module Flatware::Cucumber::Formatters
|
5
|
-
class Console
|
6
|
-
#for format_string
|
7
|
-
include ::Cucumber::Formatter::Console
|
8
|
-
|
9
|
-
FORMATS = {
|
10
|
-
passed: '.',
|
11
|
-
failed: 'F',
|
12
|
-
undefined: 'U',
|
13
|
-
pending: 'P',
|
14
|
-
skipped: '-'
|
15
|
-
}
|
16
|
-
|
17
|
-
STATUSES = FORMATS.keys
|
18
|
-
|
19
|
-
attr_reader :out, :err
|
20
|
-
|
21
|
-
def initialize(stdout, stderr)
|
22
|
-
@out, @err = stdout, stderr
|
23
|
-
end
|
24
|
-
|
25
|
-
def progress(result)
|
26
|
-
out.print format result.progress
|
27
|
-
end
|
28
|
-
|
29
|
-
def summarize(checkpoints)
|
30
|
-
steps = checkpoints.flat_map(&:steps)
|
31
|
-
scenarios = checkpoints.flat_map(&:scenarios)
|
32
|
-
Summary.new(steps, scenarios, out).summarize
|
33
|
-
end
|
34
|
-
|
35
|
-
def summarize_remaining(remaining_jobs)
|
36
|
-
out.puts
|
37
|
-
out.puts "The following features have not been run:"
|
38
|
-
for job in remaining_jobs
|
39
|
-
out.puts job.id
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def format(status)
|
45
|
-
format_string FORMATS[status], status
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'cucumber/formatter/console'
|
2
|
-
require 'flatware/cucumber/formatters/console'
|
3
|
-
require 'flatware/cucumber/checkpoint'
|
4
|
-
|
5
|
-
module Flatware::Cucumber::Formatters
|
6
|
-
class Console
|
7
|
-
class Summary
|
8
|
-
include ::Cucumber::Formatter::Console
|
9
|
-
attr_reader :io, :steps, :scenarios
|
10
|
-
|
11
|
-
def initialize(steps, scenarios=[], io=StringIO.new)
|
12
|
-
@io = io
|
13
|
-
@steps = steps
|
14
|
-
@scenarios = scenarios
|
15
|
-
end
|
16
|
-
|
17
|
-
def summarize
|
18
|
-
2.times { io.puts }
|
19
|
-
print_failures(steps, 'step')
|
20
|
-
print_failures(scenarios.select(&:failed_outside_step?), 'scenario')
|
21
|
-
print_failed_scenarios scenarios
|
22
|
-
print_counts 'scenario', scenarios
|
23
|
-
print_counts 'step', steps
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def print_failed_scenarios(scenarios)
|
29
|
-
return unless scenarios.any? &with_status(:failed)
|
30
|
-
|
31
|
-
io.puts format_string "Failing Scenarios:", :failed
|
32
|
-
scenarios.select(&with_status(:failed)).sort_by(&:file_colon_line).each do |scenario|
|
33
|
-
io.puts format_string(scenario.file_colon_line, :failed) + format_string(" # Scenario: " + scenario.name, :comment)
|
34
|
-
end
|
35
|
-
io.puts
|
36
|
-
end
|
37
|
-
|
38
|
-
def print_failures(collection, label)
|
39
|
-
failures = collection.select(&with_status(:failed))
|
40
|
-
print_elements failures, :failed, pluralize(label, failures.size)
|
41
|
-
end
|
42
|
-
|
43
|
-
def print_counts(label, collection)
|
44
|
-
io.puts pluralize(label, collection.size) + count_summary(collection)
|
45
|
-
end
|
46
|
-
|
47
|
-
def pluralize(word, number)
|
48
|
-
"#{number} #{number == 1 ? word : word + 's'}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def with_status(status)
|
52
|
-
proc {|r| r.status == status}
|
53
|
-
end
|
54
|
-
|
55
|
-
def count_summary(results)
|
56
|
-
return "" unless results.any?
|
57
|
-
status_counts = STATUSES.map do |status|
|
58
|
-
count = results.select(&with_status(status)).size
|
59
|
-
format_string "#{count} #{status}", status if count > 0
|
60
|
-
end.compact.join ", "
|
61
|
-
|
62
|
-
" (#{status_counts})"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Flatware
|
2
|
-
module Cucumber
|
3
|
-
class Result
|
4
|
-
attr_reader :progress, :worker
|
5
|
-
|
6
|
-
def initialize(progress)
|
7
|
-
@progress = progress
|
8
|
-
@worker = ENV['TEST_ENV_NUMBER'].to_i
|
9
|
-
end
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def step(*args)
|
13
|
-
step = StepResult.new *args
|
14
|
-
new step.progress, [step]
|
15
|
-
end
|
16
|
-
|
17
|
-
def status(status)
|
18
|
-
new status
|
19
|
-
end
|
20
|
-
|
21
|
-
def background(status, exception)
|
22
|
-
new '', [StepResult.new(status, exception)]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'cucumber'
|
2
|
-
|
3
|
-
module Flatware
|
4
|
-
module Cucumber
|
5
|
-
class Runtime < ::Cucumber::Runtime
|
6
|
-
|
7
|
-
attr_accessor :configuration, :loader
|
8
|
-
attr_reader :out, :err
|
9
|
-
attr_reader :visitor
|
10
|
-
|
11
|
-
def initialize(out=StringIO.new, err=out)
|
12
|
-
@out, @err = out, err
|
13
|
-
super(default_configuration)
|
14
|
-
load_step_definitions
|
15
|
-
@results = Results.new(configuration)
|
16
|
-
end
|
17
|
-
|
18
|
-
def default_configuration
|
19
|
-
config = ::Cucumber::Cli::Configuration.new
|
20
|
-
config.parse! []
|
21
|
-
config
|
22
|
-
end
|
23
|
-
|
24
|
-
def run(feature_files=[], options=[])
|
25
|
-
@loader = nil
|
26
|
-
options = Array(feature_files) + %w[--format Flatware::Cucumber::Formatter] + options
|
27
|
-
|
28
|
-
configure(::Cucumber::Cli::Main.new(options, out, err).configuration)
|
29
|
-
|
30
|
-
self.visitor = configuration.build_tree_walker(self)
|
31
|
-
visitor.visit_features(features)
|
32
|
-
results
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -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
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'flatware/serialized_exception'
|
2
|
-
module Flatware
|
3
|
-
module Cucumber
|
4
|
-
class StepResult
|
5
|
-
attr_reader :status, :exception
|
6
|
-
|
7
|
-
def initialize(status, exception)
|
8
|
-
@status, @exception = status, (serialized(exception) if exception)
|
9
|
-
end
|
10
|
-
|
11
|
-
def passed?
|
12
|
-
status == :passed
|
13
|
-
end
|
14
|
-
|
15
|
-
def failed?
|
16
|
-
status == :failed
|
17
|
-
end
|
18
|
-
|
19
|
-
def progress
|
20
|
-
Cucumber::ProgressString.format(status)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
def serialized(e)
|
25
|
-
e.backtrace and e.backtrace.unshift e.backtrace.shift.sub(Dir.pwd, '.')
|
26
|
-
SerializedException.new(e.class, e.message, e.backtrace)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/lib/flatware/pids.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'flatware/processor_info'
|
2
|
-
module Flatware
|
3
|
-
extend self
|
4
|
-
# All the pids of all the processes called flatware on this machine
|
5
|
-
def pids
|
6
|
-
pids_command.map do |row|
|
7
|
-
row =~ /(\d+).*flatware/ and $1.to_i
|
8
|
-
end.compact
|
9
|
-
end
|
10
|
-
|
11
|
-
def pids_command
|
12
|
-
case ProcessorInfo.operating_system
|
13
|
-
when 'Darwin'
|
14
|
-
`ps -c -opid,pgid,command`
|
15
|
-
when 'Linux'
|
16
|
-
`ps -opid,pgid,command`
|
17
|
-
end.split("\n")[1..-1]
|
18
|
-
end
|
19
|
-
|
20
|
-
def pids_of_group(group_pid)
|
21
|
-
pids_command.map(&:split).map do |pid, pgid, _|
|
22
|
-
pid.to_i if pgid.to_i == group_pid
|
23
|
-
end.compact
|
24
|
-
end
|
25
|
-
end
|