Module: ParallelCucumber::Helper::Cucumber
- Defined in:
- lib/parallel_cucumber/helper/cucumber.rb
Class Method Summary collapse
- .batch_mapped_files(options, batch, env) ⇒ Object
- .parse_json_report(json_report) ⇒ Object
- .selected_tests(options, args_string) ⇒ Object
Class Method Details
.batch_mapped_files(options, batch, env) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/parallel_cucumber/helper/cucumber.rb', line 18 def batch_mapped_files(, batch, env) = .dup = (, env) unless config_file.nil? file_map = {} .gsub!(/(?:\s|^)--dry-run\s+/, '') .gsub!(%r{((?:\s|^)(?:--out|-o))\s+((?:\S+\/)?(\S+))}) { "#{$1} #{file_map[$2] = "#{batch}/#{$3}"}" } # rubocop:disable Style/PerlBackrefs, Metrics/LineLength [, file_map] end |
.parse_json_report(json_report) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/parallel_cucumber/helper/cucumber.rb', line 27 def parse_json_report(json_report) report = JSON.parse(json_report) report.map do |feature| next if feature['elements'].nil? background = {} feature['elements'].map do |scenario| if scenario['type'] == 'background' background = scenario next end steps = [background['steps'], scenario['steps']].flatten.compact status = case # rubocop:disable Style/EmptyCaseCondition when steps.map { |step| step['result'] }.all? { |result| result['status'] == 'skipped' } Status::SKIPPED when steps.map { |step| step['result'] }.any? { |result| result['status'] == 'failed' } Status::FAILED when steps.map { |step| step['result'] }.all? { |result| result['status'] == 'passed' } Status::PASSED when steps.map { |step| step['result'] }.any? { |result| result['status'] == 'undefined' } Status::UNKNOWN else Status::UNKNOWN end { "#{feature['uri']}:#{scenario['line']}".to_sym => status } end end.flatten.compact.inject(&:merge) || {} end |
.selected_tests(options, args_string) ⇒ Object
12 13 14 15 16 |
# File 'lib/parallel_cucumber/helper/cucumber.rb', line 12 def selected_tests(, args_string) puts "selected_tests (#{.inspect} #{args_string.inspect})" dry_run_report = dry_run_report(, args_string) parse_json_report(dry_run_report).keys end |