launcuke 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/launcuke/runner.rb +32 -13
- data/lib/launcuke/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTZhMGU5OGU4MzBkNDlhMDIwYTdiZTI4ZWRiYzlkYjRkNTljYTczNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjAzZTM0N2UzNWI1NGNjZGQ2OGVkMmUyOGVjOGZhMTQ4ZDIwZDUzMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2FkM2JlN2M2ZWQzMjgzNDZmN2NkMjMxYmI2YzljYTZiNWU3NGYyNDlkMGFk
|
10
|
+
MzgxMmE5NmQ4Zjc3YzExYTYwOTVlMWYxZDU2Y2UwN2JmMTdkNGI5OWQxYTNl
|
11
|
+
MmUzN2RjODNmZGQwNWNiZmIzMDkzZmU4ZGRmNjQyMWM1MTkyNmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjIwMjBlMjgyNzAzYmZlZjJjM2Q0NjM5ZDIyMGIwYjkwMjQzYzYxMThiODFj
|
14
|
+
MmYzYjYxNzA3OGI4ODlmMmE2MTU3MGE3MWNkNGE2NmI3NWU0MjQ2NWJmNDU1
|
15
|
+
MDE5ZmU0YTExMmJiN2QxNDEwMzExZWNhMmU3MzdkMTA3NGFiNTc=
|
data/lib/launcuke/runner.rb
CHANGED
@@ -89,9 +89,13 @@ module Launcuke
|
|
89
89
|
# Delegate to a wrapper of system call in order mock/test
|
90
90
|
attr_accessor :system_command
|
91
91
|
|
92
|
+
# Define the launch mode, parallel or sequential
|
93
|
+
attr_accessor :mode
|
94
|
+
|
92
95
|
def initialize(features_root)
|
93
96
|
@features_root_path = features_root
|
94
97
|
@extra_options ||= []
|
98
|
+
@mode = @extra_options[2]? "#{@extra_options[2]}" : 'sequential'
|
95
99
|
yield self if block_given?
|
96
100
|
|
97
101
|
@dry_run = false if dry_run.nil?
|
@@ -108,7 +112,7 @@ module Launcuke
|
|
108
112
|
|
109
113
|
def start
|
110
114
|
FileUtils.mkdir_p reports_path
|
111
|
-
exit_status =
|
115
|
+
exit_status = launch_process
|
112
116
|
collect_results
|
113
117
|
reports = ReportsIndex.new(reports_path, features_dirs).generate
|
114
118
|
puts "See reports index at #{reports.index_path}" if reports
|
@@ -117,21 +121,36 @@ module Launcuke
|
|
117
121
|
|
118
122
|
private
|
119
123
|
|
120
|
-
def
|
124
|
+
def launch_process
|
121
125
|
if dry_run
|
122
126
|
0
|
123
127
|
else
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
case @mode
|
129
|
+
when 'sequential'
|
130
|
+
results = features_dirs.each { |features_dir|
|
131
|
+
report_file_path = File.join(reports_path, "#{features_dir.dir_name}.html")
|
132
|
+
feature_full_path = File.join(features_root_path, "#{features_dir.dir_name}")
|
133
|
+
main_command = %W[bundle exec cucumber #{feature_full_path}]
|
134
|
+
options = %W[--format html --out #{report_file_path}]
|
135
|
+
options.concat %W[--require #{features_root_path}] if require_features_root_option
|
136
|
+
full_command = main_command + options + extra_options
|
137
|
+
result = system_command.run full_command
|
138
|
+
puts "Features '#{features_dir.dir_name.upcase}' finished. #{result ? 'SUCCESS' : 'FAILURE'} (pid: #{Process.pid})"
|
139
|
+
result
|
140
|
+
}
|
141
|
+
when 'parallel'
|
142
|
+
results = features_dirs.forkoff!(:processes => forks_pool_size) { |features_dir|
|
143
|
+
report_file_path = File.join(reports_path, "#{features_dir.dir_name}.html")
|
144
|
+
feature_full_path = File.join(features_root_path, "#{features_dir.dir_name}")
|
145
|
+
main_command = %W[bundle exec cucumber #{feature_full_path}]
|
146
|
+
options = %W[--format html --out #{report_file_path}]
|
147
|
+
options.concat %W[--require #{features_root_path}] if require_features_root_option
|
148
|
+
full_command = main_command + options + extra_options
|
149
|
+
result = system_command.run full_command
|
150
|
+
puts "Features '#{features_dir.dir_name.upcase}' finished. #{result ? 'SUCCESS' : 'FAILURE'} (pid: #{Process.pid})"
|
151
|
+
result
|
152
|
+
}
|
153
|
+
end
|
135
154
|
|
136
155
|
global_exit_status = results.inject(0) { |acc, result|
|
137
156
|
result ? acc : acc + 1
|
data/lib/launcuke/version.rb
CHANGED