Sha256: 24abe975a044af9b946bd976b41de1272c580615e72e7e7b1160e056d362beda

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

require 'cucumber'
require 'cucumber/rspec/disable_option_parser'
require 'cucumber/cli/main'

module Cucumber
  module Ast
    class Features
      attr_accessor :features
    end

    class Feature
      def to_s
        title
      end
    end
  end
end

module TestQueue
  class Runner
    class Cucumber < Runner
      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

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

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

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
test-queue-split-0.3.1 lib/test_queue/runner/cucumber.rb
test-queue-split-0.3.0 lib/test_queue/runner/cucumber.rb
test-queue-0.2.13 lib/test_queue/runner/cucumber.rb
test-queue-0.2.12 lib/test_queue/runner/cucumber.rb
test-queue-0.2.11 lib/test_queue/runner/cucumber.rb
test-queue-0.2.10 lib/test_queue/runner/cucumber.rb