class ParallelTests::Cucumber::Runner
Public Class Methods
cucumber_opts(given)
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 65 def self.cucumber_opts(given) if given =~ /--profile/ or given =~ /(^|\s)-p / given else [given, profile_from_config].compact.join(" ") end end
executable()
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 19 def self.executable if ParallelTests.bundler_enabled? "bundle exec cucumber" elsif File.file?("script/cucumber") "script/cucumber" else "cucumber" end end
line_is_result?(line)
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 41 def self.line_is_result?(line) line =~ /^\d+ (steps?|scenarios?)/ end
profile_from_config()
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 73 def self.profile_from_config # copied from https://github.com/cucumber/cucumber/blob/master/lib/cucumber/cli/profile_loader.rb#L85 config = Dir.glob('{,.config/,config/}cucumber{.yml,.yaml}').first if config && File.read(config) =~ /^parallel:/ "--profile parallel" end end
run_tests(test_files, process_number, options)
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 6 def self.run_tests(test_files, process_number, options) color = ($stdout.tty? ? 'AUTOTEST=1 ; export AUTOTEST ;' : '')#display color when we are in a terminal runtime_logging = " --format ParallelTests::Cucumber::RuntimeLogger --out #{runtime_log}" cmd = [ color, executable, (runtime_logging if File.directory?(File.dirname(runtime_log))), cucumber_opts(options[:test_options]), *test_files ].compact.join(" ") execute_command(cmd, process_number, options) end
runtime_log()
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 29 def self.runtime_log 'tmp/parallel_runtime_cucumber.log' end
summarize_results(results)
click to toggle source
cucumber has 2 result lines per test run, that cannot be added 1 scenario (1 failed) 1 step (1 failed)
# File lib/parallel_tests/cucumber/runner.rb, line 48 def self.summarize_results(results) sort_order = %w[scenario step failed undefined skipped pending passed] %w[scenario step].map do |group| group_results = results.grep /^\d+ #{group}/ next if group_results.empty? sums = sum_up_results(group_results) sums = sums.sort_by { |word, _| sort_order.index(word) || 999 } sums.map! do |word, number| plural = "s" if word == group and number != 1 "#{number} #{word}#{plural}" end "#{sums[0]} (#{sums[1..-1].join(", ")})" end.compact.join("\n") end
test_file_name()
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 33 def self.test_file_name "feature" end
test_suffix()
click to toggle source
# File lib/parallel_tests/cucumber/runner.rb, line 37 def self.test_suffix ".feature" end
tests_in_groups(tests, num_groups, options={})
click to toggle source
Calls superclass method
ParallelTests::Test::Runner::tests_in_groups
# File lib/parallel_tests/cucumber/runner.rb, line 81 def self.tests_in_groups(tests, num_groups, options={}) if options[:group_by] == :steps Grouper.by_steps(find_tests(tests, options), num_groups) else super end end