semaphore_test_boosters 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/test_boosters/cucumber_booster.rb +10 -10
- data/lib/test_boosters/rspec_booster.rb +15 -15
- data/lib/test_boosters/version.rb +1 -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: de11355f9b3609986d8302b9bc0619371bd28ef2
|
4
|
+
data.tar.gz: 142b0c79b6ff473d3743df0da109287f200778b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf7b88817b12d5716046646cd1fd2c6f613deba3b27ac1a8c228d050724a91dae8bb13d3b2c8620bf892a36d36bc75291e307b6efe9c4cae5f7e0ee68f43e063
|
7
|
+
data.tar.gz: 666f07b3aa17dc5eeece0777f6cbfde7bba6552dd1f75295a14bf4780eec7b7f45f713cd0eb532615941ddffc212c76639aff40b1778812da48cfe755c3c68d7
|
@@ -9,7 +9,7 @@ module Semaphore
|
|
9
9
|
class CucumberBooster
|
10
10
|
def initialize(thread_index)
|
11
11
|
@thread_index = thread_index
|
12
|
-
@
|
12
|
+
@cucumber_split_configuration_path = ENV["CUCUMBER_SPLIT_CONFIGURATION_PATH"] || "#{ENV["HOME"]}/cucumber_split_configuration.json"
|
13
13
|
@spec_path = ENV["SPEC_PATH"] || "features"
|
14
14
|
end
|
15
15
|
|
@@ -41,21 +41,21 @@ module Semaphore
|
|
41
41
|
|
42
42
|
def select
|
43
43
|
with_fallback do
|
44
|
-
|
45
|
-
thread_count =
|
46
|
-
thread =
|
44
|
+
file_distribution = JSON.parse(File.read(@cucumber_split_configuration_path))
|
45
|
+
thread_count = file_distribution.count
|
46
|
+
thread = file_distribution[@thread_index]
|
47
47
|
|
48
48
|
all_features = Dir["#{@spec_path}/**/*.feature"].sort
|
49
|
-
all_known_features =
|
49
|
+
all_known_features = file_distribution.map { |t| t["files"] }.flatten.sort
|
50
50
|
|
51
51
|
all_leftover_features = all_features - all_known_features
|
52
|
-
thread_leftover_features = LeftoverFiles
|
52
|
+
thread_leftover_features = LeftoverFiles.select(all_leftover_features, thread_count, @thread_index)
|
53
53
|
thread_features = all_features & thread["files"].sort
|
54
54
|
features_to_run = thread_features + thread_leftover_features
|
55
55
|
|
56
|
-
Semaphore
|
57
|
-
Semaphore
|
58
|
-
Semaphore
|
56
|
+
Semaphore.display_files("This thread features:", thread_features)
|
57
|
+
Semaphore.display_title_and_count("All leftover features:", all_leftover_features)
|
58
|
+
Semaphore.display_files("This thread leftover features:", thread_leftover_features)
|
59
59
|
|
60
60
|
features_to_run
|
61
61
|
end
|
@@ -73,7 +73,7 @@ module Semaphore
|
|
73
73
|
|
74
74
|
error += %{Exception: #{e.message}}
|
75
75
|
|
76
|
-
Semaphore
|
76
|
+
Semaphore.log(error)
|
77
77
|
|
78
78
|
raise
|
79
79
|
end
|
@@ -9,6 +9,7 @@ module Semaphore
|
|
9
9
|
class RspecBooster
|
10
10
|
def initialize(thread_index)
|
11
11
|
@thread_index = thread_index
|
12
|
+
@rspec_split_configuration_path = ENV["RSPEC_SPLIT_CONFIGURATION_PATH"] || "#{ENV["HOME"]}/rspec_split_configuration.json"
|
12
13
|
@report_path = ENV["REPORT_PATH"] || "#{ENV["HOME"]}/rspec_report.json"
|
13
14
|
@spec_path = ENV["SPEC_PATH"] || "spec"
|
14
15
|
end
|
@@ -19,7 +20,7 @@ module Semaphore
|
|
19
20
|
specs_to_run = select
|
20
21
|
|
21
22
|
if specs_to_run.empty?
|
22
|
-
|
23
|
+
puts "No spec files in this thread!"
|
23
24
|
else
|
24
25
|
exit_code = run_command(specs_to_run.join(" "))
|
25
26
|
end
|
@@ -38,26 +39,26 @@ module Semaphore
|
|
38
39
|
puts "========================= Running Rspec =========================="
|
39
40
|
puts
|
40
41
|
|
41
|
-
Semaphore
|
42
|
+
Semaphore.execute("bundle exec rspec #{options} #{specs}")
|
42
43
|
end
|
43
44
|
|
44
45
|
def select
|
45
46
|
with_fallback do
|
46
|
-
|
47
|
-
thread_count =
|
48
|
-
thread =
|
47
|
+
file_distribution = JSON.parse(File.read(@rspec_split_configuration_path))
|
48
|
+
thread_count = file_distribution.count
|
49
|
+
thread = file_distribution[@thread_index]
|
49
50
|
|
50
51
|
all_specs = Dir["#{@spec_path}/**/*_spec.rb"].sort
|
51
|
-
all_known_specs =
|
52
|
+
all_known_specs = file_distribution.map { |t| t["files"] }.flatten.sort
|
52
53
|
|
53
54
|
all_leftover_specs = all_specs - all_known_specs
|
54
|
-
thread_leftover_specs = LeftoverFiles
|
55
|
+
thread_leftover_specs = LeftoverFiles.select(all_leftover_specs, thread_count, @thread_index)
|
55
56
|
thread_specs = all_specs & thread["files"].sort
|
56
57
|
specs_to_run = thread_specs + thread_leftover_specs
|
57
58
|
|
58
|
-
Semaphore
|
59
|
-
Semaphore
|
60
|
-
Semaphore
|
59
|
+
Semaphore.display_files("This thread specs:", thread_specs)
|
60
|
+
Semaphore.display_title_and_count("All leftover specs:", all_leftover_specs)
|
61
|
+
Semaphore.display_files("This thread leftover specs:", thread_leftover_specs)
|
61
62
|
|
62
63
|
specs_to_run
|
63
64
|
end
|
@@ -69,14 +70,13 @@ module Semaphore
|
|
69
70
|
rescue StandardError => e
|
70
71
|
error = %{
|
71
72
|
WARNING: An error detected while parsing the test boosters report file.
|
72
|
-
WARNING: All tests will be executed on the first thread
|
73
|
+
WARNING: All tests will be executed on the first thread.\n
|
73
74
|
}
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
error += %{Exception: #{e.message}}
|
76
|
+
error += %{Exception: #{e.message}\n#{e.backtrace.join("\n")}}
|
78
77
|
|
79
|
-
|
78
|
+
puts error
|
79
|
+
Semaphore.log(error)
|
80
80
|
|
81
81
|
raise
|
82
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semaphore_test_boosters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MAINTAINER Rendered Text
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semaphore_cucumber_booster_config
|