parallel_cucumber 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -3
- data/lib/parallel_cucumber/cli.rb +0 -8
- data/lib/parallel_cucumber/dsl.rb +4 -0
- data/lib/parallel_cucumber/hooks.rb +12 -0
- data/lib/parallel_cucumber/version.rb +1 -1
- data/lib/parallel_cucumber/worker.rb +8 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50176784f3a666778c3c6e4ebf590e9121a7aef8b054d0180841f2bf30320132
|
4
|
+
data.tar.gz: 8fa12b1fa391046c64cb0b7e175a557a7d8d3e202107b94ad42ac0a60dc851f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef3d82e89d50c8ee68553a55a51c7cebb24fec61223dd66cbb392c39090b5f42fcb101b618b16ae0dd068b3f4affbf1d863bf50b4a21497ff62df51c3cb7fd63
|
7
|
+
data.tar.gz: e8fc52cbf754cd46e0fb5b69aa5d75703008f6f71cb75202be2e964460cace827025f6af0ebd0d69fd6c6af742a2ae49a96d3b55762644d0f506fb8f6f65bc71
|
data/README.md
CHANGED
@@ -11,9 +11,6 @@ Example: parallel_cucumber -n 4 -o "-f pretty -f html -o report.html" examples/i
|
|
11
11
|
--directed-tests JSON Direct tests to specific workers, e.g. {"0": "-t @head"}
|
12
12
|
--test-command COMMAND Command to run for test phase, default cucumber
|
13
13
|
--pre-batch-check COMMAND Command causing worker to quit on exit failure
|
14
|
-
--on-batch-error COMMAND Command to call on any error happened while running batch of tests.
|
15
|
-
It will receive as argument json file with list of tests and error happened.
|
16
|
-
--no-pretty Now a no-op for compatibility there is no default pretty
|
17
14
|
--log-dir DIR Directory for worker logfiles
|
18
15
|
--log-decoration JSON Block quoting for logs, e.g. {start: "#start %s", end: "#end %s"}
|
19
16
|
--summary JSON Summary files, e.g. {failed: "./failed.txt", unknown: "./unknown.txt"}
|
@@ -89,14 +89,6 @@ module ParallelCucumber
|
|
89
89
|
options[:pre_check] = pre_check
|
90
90
|
end
|
91
91
|
|
92
|
-
opts.on('--on-batch-error COMMAND',
|
93
|
-
'Command to call on any error happened while running batch of tests.
|
94
|
-
It will receive as argument json file with list of tests and error happened.') do |on_batch_error|
|
95
|
-
options[:on_batch_error] = on_batch_error
|
96
|
-
end
|
97
|
-
|
98
|
-
opts.on('--no-pretty', 'Now a no-op for compatibility there is no default pretty') {}
|
99
|
-
|
100
92
|
opts.on('--log-dir DIR', 'Directory for worker logfiles') do |log_dir|
|
101
93
|
options[:log_dir] = log_dir
|
102
94
|
end
|
@@ -3,6 +3,7 @@ module ParallelCucumber
|
|
3
3
|
@before_batch_hooks ||= []
|
4
4
|
@after_batch_hooks ||= []
|
5
5
|
@after_workers ||= []
|
6
|
+
@on_batch_error ||= []
|
6
7
|
|
7
8
|
class << self
|
8
9
|
def register_before_batch(proc)
|
@@ -20,6 +21,11 @@ module ParallelCucumber
|
|
20
21
|
@after_workers << proc
|
21
22
|
end
|
22
23
|
|
24
|
+
def register_on_batch_error(proc)
|
25
|
+
raise(ArgumentError, 'Please provide a valid callback') unless proc.respond_to?(:call)
|
26
|
+
@on_batch_error << proc
|
27
|
+
end
|
28
|
+
|
23
29
|
def fire_before_batch_hooks(*args)
|
24
30
|
@before_batch_hooks.each do |hook|
|
25
31
|
hook.call(*args)
|
@@ -37,6 +43,12 @@ module ParallelCucumber
|
|
37
43
|
hook.call(*args)
|
38
44
|
end
|
39
45
|
end
|
46
|
+
|
47
|
+
def fire_on_batch_error(*args)
|
48
|
+
@on_batch_error.each do |hook|
|
49
|
+
hook.call(*args)
|
50
|
+
end
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
42
54
|
end
|
@@ -33,7 +33,6 @@ module ParallelCucumber
|
|
33
33
|
@cucumber_options = options[:cucumber_options]
|
34
34
|
@test_command = options[:test_command]
|
35
35
|
@pre_check = options[:pre_check]
|
36
|
-
@on_batch_error = options[:on_batch_error]
|
37
36
|
@index = index
|
38
37
|
@queue_connection_params = options[:queue_connection_params]
|
39
38
|
@setup_worker = options[:setup_worker]
|
@@ -177,31 +176,6 @@ module ParallelCucumber
|
|
177
176
|
end
|
178
177
|
end
|
179
178
|
|
180
|
-
def on_batch_error(batch_env, batch_id, error_file, tests, error)
|
181
|
-
return unless @on_batch_error
|
182
|
-
|
183
|
-
begin
|
184
|
-
error_info = {
|
185
|
-
class: error.class,
|
186
|
-
message: error.message,
|
187
|
-
backtrace: error.backtrace
|
188
|
-
}
|
189
|
-
batch_error_info = {
|
190
|
-
batch_id: batch_id,
|
191
|
-
tests: tests,
|
192
|
-
error: error_info
|
193
|
-
}
|
194
|
-
File.write(error_file, batch_error_info.to_json)
|
195
|
-
command = "#{@on_batch_error} #{error_file}"
|
196
|
-
Helper::Command.exec_command(
|
197
|
-
batch_env, 'on_batch_error', command, @logger, @log_decoration, timeout: @batch_error_timeout
|
198
|
-
)
|
199
|
-
rescue => e
|
200
|
-
message = "on-batch-error failed: #{e.message}"
|
201
|
-
@logger.warn(message)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
179
|
def running_totals(batch_results, running_total)
|
206
180
|
batch_info = Status.constants.map do |status|
|
207
181
|
status = Status.const_get(status)
|
@@ -253,8 +227,14 @@ module ParallelCucumber
|
|
253
227
|
)
|
254
228
|
rescue => e
|
255
229
|
@logger << "ERROR #{e} #{e.backtrace.first(5)}"
|
256
|
-
|
257
|
-
|
230
|
+
|
231
|
+
begin
|
232
|
+
Hooks.fire_on_batch_error(tests: tests, batch_id: batch_id, env: batch_env, exception: e)
|
233
|
+
rescue StandardError => exc
|
234
|
+
trace = exc.backtrace.join("\n\t")
|
235
|
+
@logger.warn("There was exception in on_batch_error hook #{exc.message} \n #{trace}")
|
236
|
+
end
|
237
|
+
|
258
238
|
return tests.map { |t| [t, ::ParallelCucumber::Status::UNKNOWN] }.to_h
|
259
239
|
end
|
260
240
|
parse_results(test_state, tests)
|
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.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Bayandin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|