Class: TestQueue::Runner::Cucumber

Inherits:
TestQueue::Runner show all
Defined in:
lib/test_queue/runner/cucumber.rb

Instance Attribute Summary

Attributes inherited from TestQueue::Runner

#concurrency

Instance Method Summary collapse

Methods inherited from TestQueue::Runner

#after_fork, #after_fork_internal, #around_filter, #cleanup_worker, #connect_to_relay, #distribute_queue, #execute, #execute_parallel, #execute_sequential, #prepare, #reap_worker, #relay?, #relay_to_master, #spawn_workers, #start_master, #stats, #stats_file, #stop_master, #summarize, #summarize_internal, #worker_completed

Constructor Details

#initializeCucumber

Returns a new instance of Cucumber.



22
23
24
25
26
27
28
# File 'lib/test_queue/runner/cucumber.rb', line 22

def initialize
  @cli = ::Cucumber::Cli::Main.new(ARGV.dup)
  @runtime = ::Cucumber::Runtime.new(@cli.configuration)
  @features_loader = @runtime.send(:features)
  features = @features_loader.features.sort_by{ |s| -(stats[s.to_s] || 0) }
  super(features)
end

Instance Method Details

#run_worker(iterator) ⇒ Object



30
31
32
33
# File 'lib/test_queue/runner/cucumber.rb', line 30

def run_worker(iterator)
  @features_loader.features = iterator
  @cli.execute!(@runtime)
end

#summarize_worker(worker) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/test_queue/runner/cucumber.rb', line 35

def summarize_worker(worker)
  worker.stats.each do |s, val|
    stats[s.to_s] = val
  end

  output = worker.output.gsub(/\e\[\d+./,'')
  summary  = output.split("\n").grep(/^\d+ (scenarios?|steps?)/).first
  failures = output.scan(/^Failing Scenarios:\n(.*)\n\d+ scenarios?/m).join("\n")

  [ summary, failures ]
end