module AutomationHelpers::Patches::RetryFlagFix
Public Instance Methods
cucumber_opts(given)
click to toggle source
# File lib/automation_helpers/patches/parallel_cucumber.rb, line 62 def cucumber_opts(given) # All new code initial = if given =~ (/--profile/) || given =~ (/(^|\s)-p /) given else [given, profile_from_config].compact.join(" ") end opts_as_individuals = initial.scan(/\S+\s\S+/) desired_output = ['', ''] opts_as_individuals.each do |opt| if opt.match?(/--retry \d+/) desired_output[1] = opt else desired_output[0] = "#{desired_output[0]} #{opt}".strip end end desired_output end
run_tests(test_files, process_number, num_processes, options)
click to toggle source
# File lib/automation_helpers/patches/parallel_cucumber.rb, line 34 def run_tests(test_files, process_number, num_processes, options) # Copied Code - https://github.com/grosser/parallel_tests/blob/master/lib/parallel_tests/gherkin/runner.rb#L9 combined_scenarios = test_files if options[:group_by] == :scenarios grouped = test_files.map { |t| t.split(':') }.group_by(&:first) combined_scenarios = grouped.map do |file, files_and_lines| "#{file}:#{files_and_lines.map(&:last).join(':')}" end end sanitized_test_files = combined_scenarios.map { |val| WINDOWS ? "\"#{val}\"" : Shellwords.escape(val) } options[:env] ||= {} options[:env] = options[:env].merge({ 'AUTOTEST' => '1' }) if $stdout.tty? # New code opts = cucumber_opts(options[:test_options]) cmd = [ executable, (runtime_logging if File.directory?(File.dirname(runtime_log))), opts[0], *sanitized_test_files, opts[1] ].compact.reject(&:empty?).join(' ') execute_command(cmd, process_number, num_processes, options) end