Sha256: e96e367b5f5bf1dcee4d7bd12030d5f4f4f12613f8132c6d9e368e5b625d77a1

Contents?: true

Size: 1.53 KB

Versions: 19

Compression:

Stored size: 1.53 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})
        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(:cucumber).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

19 entries across 19 versions & 2 rubygems

Version Path
sauce_ruby-3.5.11 lib/parallel_tests/saucecucumber/runner.rb
sauce_ruby-3.5.10 lib/parallel_tests/saucecucumber/runner.rb
sauce_ruby-3.5.9 lib/parallel_tests/saucecucumber/runner.rb
sauce_ruby-3.5.8 lib/parallel_tests/saucecucumber/runner.rb
sauce_ruby-3.5.7 lib/parallel_tests/saucecucumber/runner.rb
sauce_ruby-3.5.6 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.6 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.5 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.4 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.3 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.2 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.1 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.5.0 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.9 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.8 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.7 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.6 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.5 lib/parallel_tests/saucecucumber/runner.rb
sauce-3.4.4 lib/parallel_tests/saucecucumber/runner.rb