parallel_cucumber 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parallel_cucumber/dsl.rb +11 -2
- data/lib/parallel_cucumber/hooks.rb +14 -2
- data/lib/parallel_cucumber/version.rb +1 -1
- data/lib/parallel_cucumber/worker.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6235aa8339ee967edde15537aee01463bad73785
|
4
|
+
data.tar.gz: e8db21507a3ffd074f7630ba9e8f93da115babf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a80ce35ae86020bce48e3ff8233c7a6906f80fa07c46bd424618948ad3f75816215fce42ee26fd139a5774cbe69bdf8e36c8154dfd1ba1ed1e2ece8166e50e
|
7
|
+
data.tar.gz: 54bca08a00b74d6d04d2919c1bfd03615087f4f34b75647fbd643be82cd5d9a0ccfece732641a63ef0ee3cca020f8bfc450385ffbf742e79c48988276e0b2ad4
|
@@ -3,10 +3,19 @@ require_relative 'hooks'
|
|
3
3
|
module ParallelCucumber
|
4
4
|
module DSL
|
5
5
|
class << self
|
6
|
+
# Registers a callback hook which will be called before every batch
|
7
|
+
# There can be more than one after_batch, they will be invoked sequentially
|
8
|
+
# If one hook fails, the rest hooks will be skipped
|
9
|
+
# @yieldparam [optional, Array] tests list of tests to run
|
10
|
+
# @yieldparam [optional, String] batch_id batch id
|
11
|
+
# @yieldparam [optional, Hash] batch_env env of batch
|
12
|
+
def before_batch(&proc)
|
13
|
+
Hooks.register_before_batch(proc)
|
14
|
+
end
|
6
15
|
|
7
16
|
# Registers a callback hook which will be called at the end of every batch
|
8
17
|
# There can be more than one after_batch, they will be invoked sequentially
|
9
|
-
# If one hook fails, rest
|
18
|
+
# If one hook fails, the rest hooks will be skipped
|
10
19
|
# @yieldparam [optional, Hash] batch_results results of all tests in a batch
|
11
20
|
# @yieldparam [optional, String] batch_id batch id
|
12
21
|
# @yieldparam [optional, Hash] batch_env env of batch
|
@@ -15,4 +24,4 @@ module ParallelCucumber
|
|
15
24
|
end
|
16
25
|
end
|
17
26
|
end
|
18
|
-
end
|
27
|
+
end
|
@@ -1,13 +1,25 @@
|
|
1
1
|
module ParallelCucumber
|
2
2
|
class Hooks
|
3
|
+
@before_batch_hooks ||= []
|
3
4
|
@after_batch_hooks ||= []
|
4
5
|
|
5
6
|
class << self
|
6
|
-
def
|
7
|
+
def register_before_batch(proc)
|
8
|
+
raise(ArgumentError, 'Please provide a valid callback') unless proc.respond_to?(:call)
|
9
|
+
@before_batch_hooks << proc
|
10
|
+
end
|
11
|
+
|
12
|
+
def register_after_batch(proc)
|
7
13
|
raise(ArgumentError, 'Please provide a valid callback') unless proc.respond_to?(:call)
|
8
14
|
@after_batch_hooks << proc
|
9
15
|
end
|
10
16
|
|
17
|
+
def fire_before_batch_hooks(*args)
|
18
|
+
@before_batch_hooks.each do |hook|
|
19
|
+
hook.call(*args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
11
23
|
def fire_after_batch_hooks(*args)
|
12
24
|
@after_batch_hooks.each do |hook|
|
13
25
|
hook.call(*args)
|
@@ -15,4 +27,4 @@ module ParallelCucumber
|
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
18
|
-
end
|
30
|
+
end
|
@@ -142,10 +142,17 @@ module ParallelCucumber
|
|
142
142
|
@logger.info("Took #{tests.count} from the queue (#{queue_tracker.status}): #{tests.join(' ')}")
|
143
143
|
|
144
144
|
batch_mm, batch_ss = time_it do
|
145
|
+
begin
|
146
|
+
Hooks.fire_before_batch_hooks(tests, batch_id, env)
|
147
|
+
rescue StandardError => e
|
148
|
+
trace = e.backtrace.join("\n\t")
|
149
|
+
@logger.warn("There was exception in before_batch hook #{e.message} \n #{trace}")
|
150
|
+
end
|
151
|
+
|
145
152
|
batch_results = test_batch(batch_id, env, running_total, tests)
|
146
153
|
begin
|
147
154
|
Hooks.fire_after_batch_hooks(batch_results, batch_id, env)
|
148
|
-
rescue => e
|
155
|
+
rescue StandardError => e
|
149
156
|
trace = e.backtrace.join("\n\t")
|
150
157
|
@logger.warn("There was exception in after_batch hook #{e.message} \n #{trace}")
|
151
158
|
end
|
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.4
|
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-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|