Sha256: 1c5a8900ad91cf304ccf4c5b38001bb0d78ac0985e44fe6a63f8022f19c4b679

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

require "parallel_tests/cucumber/runner"

module ParallelTests
  module Saucecucumber
    class Runner < ParallelTests::Cucumber::Runner

      def self.run_tests(test_files, process_number, num_processes, options)
        options = options.dup
        sanitized_test_files = test_files.map { |val| Shellwords.escape(val) }
        env = Sauce::TestBroker.next_environment(test_files)
        env.merge!({"AUTOTEST" => "1"}) if $stdout.tty? # display color when we are in a terminal
        options.merge!({:env => env})
        runtime_logging = " --format ParallelTests::Cucumber::RuntimeLogger --out #{runtime_log}"
        cmd = [
            executable,
            (runtime_logging if File.directory?(File.dirname(runtime_log))),
            cucumber_opts(options[:test_options]),
            *sanitized_test_files
        ].compact.join(" ")
        execute_command(cmd, process_number, num_processes, options)
      end

      def self.tests_in_groups(tests, num_groups, options={})
        originals = (options[:group_by] == :steps) ? Grouper.by_steps(find_tests(tests, options), num_groups, options) : super
        all_tests = originals.flatten * Sauce::TestBroker.test_platforms.length
        base_group_size = all_tests.length / num_groups
        num_full_groups = all_tests.length - (base_group_size * num_groups)

        curpos = 0
        groups = []
        num_groups.times do |i|
          group_size = base_group_size
          if i < num_full_groups
            group_size += 1
          end
          groups << all_tests.slice(curpos, group_size)
          curpos += group_size
        end

        groups
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sauce-3.0.4 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.0.2 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.0.1 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.0.0 lib/parallel_tests/saucecucumber/runner.rb