Class: ParallelTests::Cucumber::Runner

Inherits:
Gherkin::Runner
  • Object
show all
Defined in:
lib/parallel_tests/cucumber/runner.rb

Constant Summary collapse

SCENARIOS_RESULTS_BOUNDARY_REGEX =
/^(Failing|Flaky) Scenarios:$/
SCENARIO_REGEX =
%r{^cucumber features/.+:\d+}

Class Method Summary collapse

Class Method Details

.command_with_seed(cmd, seed) ⇒ Object



37
38
39
40
# File 'lib/parallel_tests/cucumber/runner.rb', line 37

def command_with_seed(cmd, seed)
  clean = remove_command_arguments(cmd, '--order')
  [*clean, '--order', "random:#{seed}"]
end

.default_test_folderObject



15
16
17
# File 'lib/parallel_tests/cucumber/runner.rb', line 15

def default_test_folder
  'features'
end

.line_is_result?(line) ⇒ Boolean

Returns:



19
20
21
# File 'lib/parallel_tests/cucumber/runner.rb', line 19

def line_is_result?(line)
  super || line =~ SCENARIO_REGEX || line =~ SCENARIOS_RESULTS_BOUNDARY_REGEX
end

.nameObject



11
12
13
# File 'lib/parallel_tests/cucumber/runner.rb', line 11

def name
  'cucumber'
end

.summarize_results(results) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/parallel_tests/cucumber/runner.rb', line 23

def summarize_results(results)
  output = []

  scenario_groups = results.slice_before(SCENARIOS_RESULTS_BOUNDARY_REGEX).group_by(&:first)
  scenario_groups.each do |header, group|
    scenarios = group.flatten.grep(SCENARIO_REGEX)
    output << ([header] + scenarios).join("\n") if scenarios.any?
  end

  output << super

  output.join("\n\n")
end