parallel_cucumber 0.2.18 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 910908ef4d933b4914d5ea9872946844feaf4755fde1e33e1739438ed2bca2d5
4
- data.tar.gz: 0cc6af7cd57aa6c29525514a497ecfdd82df69536782e383c36fbd47851c50fe
3
+ metadata.gz: 9ae598edd0afabdd7a9ff4ae2b117505e52a05028e79e8c01065548cf28d3298
4
+ data.tar.gz: acb97b25354b64a8acdd9bfc87c631135042759a16b2aa3df4717a459c0e3946
5
5
  SHA512:
6
- metadata.gz: 4a5f7ea51c8407311ad96825e829e6a823cb6e7a6db37bc498c9f785485153d18f43dd616b0d351e69bdc869437603267edbc02de69ad90ddb26bec30422354f
7
- data.tar.gz: 77878547532ac93709d73e5eab115fadb56deb6709b0a13716fd020e04643e359eed868bc10ba3313c1893ffd94e6e7e6419040813ee420dba59a3cff72aeef1
6
+ metadata.gz: 731c24ee0e9d627768a97be407ab15ff2259e9ba14dae9cba0cc995100e737c64ae11fc29560a6c4eabd0faafb06a8fbdd15a880271efeba2fe08e52b2c14511
7
+ data.tar.gz: f2ca8028be443de6b883a99358d5e2c32de9d916768b6a0f2be01945aefc8459cd83b3e982cdc89921e2a580e0a3789fff45011d9ede4a13a5fbe23e2b485bb3
@@ -26,25 +26,25 @@ module ParallelCucumber
26
26
 
27
27
  def parse_json_report(json_report)
28
28
  report = JSON.parse(json_report, symbolize_names: true)
29
- report.map do |scenario, cucumber_status|
30
- status = case cucumber_status
31
- when 'failed'
32
- Status::FAILED
33
- when 'passed'
34
- Status::PASSED
35
- when 'pending'
36
- Status::PENDING
37
- when 'skipped'
38
- Status::SKIPPED
39
- when 'undefined'
40
- Status::UNDEFINED
41
- when 'unknown'
42
- Status::UNKNOWN
43
- else
44
- Status::UNKNOWN
45
- end
46
- [scenario, status]
47
- end.to_h
29
+ report.each do |scenario, details|
30
+ report[scenario][:status] = case details[:status]
31
+ when 'failed'
32
+ Status::FAILED
33
+ when 'passed'
34
+ Status::PASSED
35
+ when 'pending'
36
+ Status::PENDING
37
+ when 'skipped'
38
+ Status::SKIPPED
39
+ when 'undefined'
40
+ Status::UNDEFINED
41
+ when 'unknown'
42
+ Status::UNKNOWN
43
+ else
44
+ Status::UNKNOWN
45
+ end
46
+ end
47
+ report
48
48
  end
49
49
 
50
50
  private
@@ -57,7 +57,7 @@ module ParallelCucumber
57
57
  options = remove_strict_flag(options)
58
58
  content = nil
59
59
 
60
- Tempfile.open(%w(dry-run .json)) do |f|
60
+ Tempfile.open(%w[dry-run .json]) do |f|
61
61
  dry_run_options = "--dry-run --format ParallelCucumber::Helper::Cucumber::JsonStatusFormatter --out #{f.path}"
62
62
 
63
63
  cmd = "cucumber #{options} #{dry_run_options} #{args_string}"
@@ -15,7 +15,13 @@ module ParallelCucumber
15
15
  end
16
16
 
17
17
  def on_after_test_case(event)
18
- @result[event.test_case.location.to_s] = event.result.to_sym
18
+ details = {status: event.result.to_sym}
19
+ if event.result.respond_to?(:exception)
20
+ details[:exception_classname] = event.result.exception.class.to_s
21
+ details[:exception_message] = event.result.exception.message
22
+ end
23
+ details[:finish_time] = Time.now.to_i
24
+ @result[event.test_case.location.to_s] = details
19
25
  end
20
26
 
21
27
  def on_finished_testing(*)
@@ -98,7 +98,7 @@ module ParallelCucumber
98
98
 
99
99
  status_totals = Status.constants.map do |status|
100
100
  status = Status.const_get(status)
101
- tests_with_status = results.select { |_t, s| s == status }.keys
101
+ tests_with_status = results.select { |_t, s| s[:status] == status }.keys
102
102
  [status, tests_with_status]
103
103
  end.to_h
104
104
 
@@ -1,3 +1,3 @@
1
1
  module ParallelCucumber
2
- VERSION = '0.2.18'.freeze
2
+ VERSION = '0.2.19'.freeze
3
3
  end
@@ -176,7 +176,7 @@ module ParallelCucumber
176
176
  def running_totals(batch_results, running_total)
177
177
  batch_info = Status.constants.map do |status|
178
178
  status = Status.const_get(status)
179
- [status, batch_results.select { |_t, s| s == status }.keys]
179
+ [status, batch_results.select { |_t, s| s[:status] == status }.keys]
180
180
  end.to_h
181
181
  batch_info.each do |s, tt|
182
182
  @logger.info("#{s.to_s.upcase} #{tt.count} tests: #{tt.join(' ')}") unless tt.empty?
@@ -191,7 +191,7 @@ module ParallelCucumber
191
191
  test_syms = tests.map(&:to_sym)
192
192
  unrun = test_syms - batch_keys
193
193
  surfeit = batch_keys - test_syms
194
- unrun.each { |test| batch_results[test] = Status::UNKNOWN }
194
+ unrun.each { |test| batch_results[test][:status] = Status::UNKNOWN }
195
195
  surfeit.each { |test| batch_results.delete(test) }
196
196
  @logger.error("Did not run #{unrun.count}/#{tests.count}: #{unrun.join(' ')}") unless unrun.empty?
197
197
  @logger.error("Extraneous runs (#{surfeit.count}): #{surfeit.join(' ')}") unless surfeit.empty?
@@ -39,7 +39,7 @@ module ParallelCucumber
39
39
  def create_workers(number_of_workers)
40
40
  number_of_workers.times do |index|
41
41
  @workers["W#{index}"] =
42
- ParallelCucumber::Worker.new(options: @options, index: index, stdout_logger: @logger, manager: self)
42
+ ParallelCucumber::Worker.new(options: @options, index: index, stdout_logger: @logger, manager: self)
43
43
  end
44
44
  end
45
45
 
@@ -67,11 +67,15 @@ module ParallelCucumber
67
67
  puts "Starting W#{index}"
68
68
  @workers["W#{index}"].start(env_for_worker(@options[:env_variables], index))
69
69
  end
70
- @results.inject(:merge) # Returns hash of file:line to statuses + :worker-index to summary.
70
+ @results.inject do |seed, result|
71
+ seed.merge(result) do |_key, oldval, newval|
72
+ (newval[:finish_time] > oldval[:finish_time]) ? newval : oldval
73
+ end
74
+ end
71
75
  end
72
76
 
73
77
  def kill_all_workers
74
- @logger.info("=== Killing All Workers")
78
+ @logger.info('=== Killing All Workers')
75
79
  @workers.values.each { |w| w.assign_job(Job.new(Job::DIE)) }
76
80
  end
77
81
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Bayandin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-29 00:00:00.000000000 Z
11
+ date: 2020-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber