parallel_tests 0.6.20 → 0.7.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +2 -4
- data/Gemfile.lock +7 -7
- data/Rakefile +18 -16
- data/Readme.md +15 -12
- data/bin/parallel_test +2 -98
- data/lib/parallel_tests.rb +2 -125
- data/lib/parallel_tests/cli.rb +102 -0
- data/lib/parallel_tests/cucumber/runner.rb +40 -0
- data/lib/parallel_tests/cucumber/runtime_logger.rb +58 -0
- data/lib/parallel_tests/grouper.rb +2 -2
- data/lib/parallel_tests/railtie.rb +3 -3
- data/lib/{parallel_specs/spec_failures_logger.rb → parallel_tests/spec/failures_logger.rb} +4 -3
- data/lib/{parallel_specs/spec_logger_base.rb → parallel_tests/spec/logger_base.rb} +7 -3
- data/lib/parallel_tests/spec/runner.rb +56 -0
- data/lib/{parallel_specs/spec_runtime_logger.rb → parallel_tests/spec/runtime_logger.rb} +2 -2
- data/lib/{parallel_specs/spec_summary_logger.rb → parallel_tests/spec/summary_logger.rb} +2 -2
- data/lib/parallel_tests/tasks.rb +0 -25
- data/lib/parallel_tests/test/runner.rb +126 -0
- data/lib/parallel_tests/test/runtime_logger.rb +92 -0
- data/lib/parallel_tests/version.rb +3 -0
- data/parallel_tests.gemspec +10 -61
- data/spec/parallel_tests/cucumber/runner_spec.rb +76 -0
- data/spec/{parallel_specs/spec_failure_logger_spec.rb → parallel_tests/spec/failure_logger_spec.rb} +8 -8
- data/spec/parallel_tests/spec/runner_spec.rb +178 -0
- data/spec/{parallel_specs/spec_runtime_logger_spec.rb → parallel_tests/spec/runtime_logger_spec.rb} +4 -4
- data/spec/{parallel_specs/spec_summary_logger_spec.rb → parallel_tests/spec/summary_logger_spec.rb} +2 -2
- data/spec/parallel_tests/test/runner_spec.rb +179 -0
- data/spec/parallel_tests/{runtime_logger_spec.rb → test/runtime_logger_spec.rb} +19 -16
- data/spec/parallel_tests_spec.rb +2 -158
- data/spec/spec_helper.rb +9 -7
- metadata +30 -26
- data/VERSION +0 -1
- data/lib/parallel_cucumber.rb +0 -36
- data/lib/parallel_cucumber/runtime_logger.rb +0 -57
- data/lib/parallel_specs.rb +0 -52
- data/lib/parallel_tests/runtime_logger.rb +0 -78
- data/lib/tasks/parallel_tests.rake +0 -1
- data/spec/parallel_cucumber_spec.rb +0 -72
- data/spec/parallel_specs_spec.rb +0 -173
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ParallelTests::RuntimeLogger do
|
4
|
-
|
3
|
+
describe ParallelTests::Test::RuntimeLogger do
|
5
4
|
describe :writing do
|
5
|
+
let(:log) { ParallelTests::Test::Runner.runtime_log }
|
6
|
+
|
6
7
|
it "overwrites the runtime_log file on first log invocation" do
|
7
8
|
class FakeTest
|
8
9
|
end
|
9
10
|
test = FakeTest.new
|
10
11
|
time = Time.now
|
11
|
-
File.open(
|
12
|
-
ParallelTests::RuntimeLogger.send(:class_variable_set,:@@has_started, false)
|
13
|
-
ParallelTests::RuntimeLogger.log(test, time, Time.at(time.to_f+2.00))
|
14
|
-
result = File.read(
|
12
|
+
File.open(log, 'w'){ |f| f.puts("FooBar") }
|
13
|
+
ParallelTests::Test::RuntimeLogger.send(:class_variable_set,:@@has_started, false)
|
14
|
+
ParallelTests::Test::RuntimeLogger.log(test, time, Time.at(time.to_f+2.00))
|
15
|
+
result = File.read(log)
|
15
16
|
result.should_not include('FooBar')
|
16
17
|
result.should include('test/fake_test.rb:2.00')
|
17
18
|
end
|
@@ -25,25 +26,28 @@ describe ParallelTests::RuntimeLogger do
|
|
25
26
|
other_test = OtherFakeTest.new
|
26
27
|
|
27
28
|
time = Time.now
|
28
|
-
File.open(
|
29
|
-
ParallelTests::RuntimeLogger.send(:class_variable_set,:@@has_started, false)
|
30
|
-
ParallelTests::RuntimeLogger.log(test, time, Time.at(time.to_f+2.00))
|
31
|
-
ParallelTests::RuntimeLogger.log(other_test, time, Time.at(time.to_f+2.00))
|
32
|
-
result = File.read(
|
29
|
+
File.open(log, 'w'){ |f| f.puts("FooBar") }
|
30
|
+
ParallelTests::Test::RuntimeLogger.send(:class_variable_set,:@@has_started, false)
|
31
|
+
ParallelTests::Test::RuntimeLogger.log(test, time, Time.at(time.to_f+2.00))
|
32
|
+
ParallelTests::Test::RuntimeLogger.log(other_test, time, Time.at(time.to_f+2.00))
|
33
|
+
result = File.read(log)
|
33
34
|
result.should_not include('FooBar')
|
34
35
|
result.should include('test/fake_test.rb:2.00')
|
35
36
|
result.should include('test/other_fake_test.rb:2.00')
|
36
37
|
end
|
37
|
-
|
38
38
|
end
|
39
39
|
|
40
40
|
describe :formatting do
|
41
|
+
def call(*args)
|
42
|
+
ParallelTests::Test::RuntimeLogger.message(*args)
|
43
|
+
end
|
44
|
+
|
41
45
|
it "formats results for simple test names" do
|
42
46
|
class FakeTest
|
43
47
|
end
|
44
48
|
test = FakeTest.new
|
45
49
|
time = Time.now
|
46
|
-
|
50
|
+
call(test, time, Time.at(time.to_f+2.00)).should == 'test/fake_test.rb:2.00'
|
47
51
|
end
|
48
52
|
|
49
53
|
it "formats results for complex test names" do
|
@@ -53,7 +57,7 @@ describe ParallelTests::RuntimeLogger do
|
|
53
57
|
end
|
54
58
|
test = AVeryComplex::FakeTest.new
|
55
59
|
time = Time.now
|
56
|
-
|
60
|
+
call(test, time, Time.at(time.to_f+2.00)).should == 'test/a_very_complex/fake_test.rb:2.00'
|
57
61
|
end
|
58
62
|
|
59
63
|
it "guesses subdirectory structure for rails test classes" do
|
@@ -67,8 +71,7 @@ describe ParallelTests::RuntimeLogger do
|
|
67
71
|
end
|
68
72
|
test = FakeControllerTest.new
|
69
73
|
time = Time.now
|
70
|
-
|
74
|
+
call(test, time, Time.at(time.to_f+2.00)).should == 'test/functional/fake_controller_test.rb:2.00'
|
71
75
|
end
|
72
76
|
end
|
73
|
-
|
74
77
|
end
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe ParallelTests do
|
4
|
-
test_tests_in_groups(ParallelTests, 'test', '_test.rb')
|
5
|
-
|
6
4
|
describe :parse_rake_args do
|
7
5
|
it "should return the count" do
|
8
6
|
args = {:count => 2}
|
@@ -58,90 +56,6 @@ describe ParallelTests do
|
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
61
|
-
describe :run_tests do
|
62
|
-
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
63
|
-
ParallelTests.should_receive(:open).with{|x,y|x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
64
|
-
ParallelTests.run_tests(['xxx'],0,{})
|
65
|
-
end
|
66
|
-
|
67
|
-
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
68
|
-
ParallelTests.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
69
|
-
ParallelTests.run_tests(['xxx'],1,{})
|
70
|
-
end
|
71
|
-
|
72
|
-
it "uses options" do
|
73
|
-
ParallelTests.should_receive(:open).with{|x,y| x=~ %r{ruby -Itest .* -- -v}}.and_return mocked_process
|
74
|
-
ParallelTests.run_tests(['xxx'],1,:test_options => '-v')
|
75
|
-
end
|
76
|
-
|
77
|
-
it "returns the output" do
|
78
|
-
io = open('spec/spec_helper.rb')
|
79
|
-
$stdout.stub!(:print)
|
80
|
-
ParallelTests.should_receive(:open).and_return io
|
81
|
-
ParallelTests.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe :test_in_groups do
|
86
|
-
it "does not sort when passed false do_sort option" do
|
87
|
-
ParallelTests.should_not_receive(:smallest_first)
|
88
|
-
ParallelTests.tests_in_groups [], 1, :no_sort => true
|
89
|
-
end
|
90
|
-
|
91
|
-
it "does sort when not passed do_sort option" do
|
92
|
-
ParallelTests.stub!(:tests_with_runtime).and_return([])
|
93
|
-
ParallelTests::Grouper.should_receive(:largest_first).and_return([])
|
94
|
-
ParallelTests.tests_in_groups [], 1
|
95
|
-
end
|
96
|
-
|
97
|
-
it "groups by single_process pattern and then via size" do
|
98
|
-
ParallelTests.should_receive(:with_runtime_info).and_return([['aaa',5],['aaa2',5],['bbb',2],['ccc',1],['ddd',1]])
|
99
|
-
result = ParallelTests.tests_in_groups [], 3, :single_process => [/^a.a/]
|
100
|
-
result.should == [["aaa", "aaa2"], ["bbb"], ["ccc", "ddd"]]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe :find_results do
|
105
|
-
it "finds multiple results in test output" do
|
106
|
-
output = <<EOF
|
107
|
-
Loaded suite /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
|
108
|
-
Started
|
109
|
-
..............
|
110
|
-
Finished in 0.145069 seconds.
|
111
|
-
|
112
|
-
10 tests, 20 assertions, 0 failures, 0 errors
|
113
|
-
Loaded suite /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
|
114
|
-
Started
|
115
|
-
..............
|
116
|
-
Finished in 0.145069 seconds.
|
117
|
-
|
118
|
-
14 tests, 20 assertions, 0 failures, 0 errors
|
119
|
-
|
120
|
-
EOF
|
121
|
-
|
122
|
-
ParallelTests.find_results(output).should == ['10 tests, 20 assertions, 0 failures, 0 errors','14 tests, 20 assertions, 0 failures, 0 errors']
|
123
|
-
end
|
124
|
-
|
125
|
-
it "is robust against scrambled output" do
|
126
|
-
output = <<EOF
|
127
|
-
Loaded suite /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
|
128
|
-
Started
|
129
|
-
..............
|
130
|
-
Finished in 0.145069 seconds.
|
131
|
-
|
132
|
-
10 tests, 20 assertions, 0 failures, 0 errors
|
133
|
-
Loaded suite /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake/rake_test_loader
|
134
|
-
Started
|
135
|
-
..............
|
136
|
-
Finished in 0.145069 seconds.
|
137
|
-
|
138
|
-
14 te.dsts, 20 assertions, 0 failures, 0 errors
|
139
|
-
EOF
|
140
|
-
|
141
|
-
ParallelTests.find_results(output).should == ['10 tests, 20 assertions, 0 failures, 0 errors','14 tedsts, 20 assertions, 0 failures, 0 errors']
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
59
|
describe :bundler_enabled? do
|
146
60
|
before do
|
147
61
|
Object.stub!(:const_defined?).with(:Bundler).and_return false
|
@@ -175,77 +89,7 @@ EOF
|
|
175
89
|
end
|
176
90
|
end
|
177
91
|
|
178
|
-
describe :find_tests do
|
179
|
-
it "returns if root is an array" do
|
180
|
-
ParallelTests.send(:find_tests, [1]).should == [1]
|
181
|
-
end
|
182
|
-
|
183
|
-
it "finds all test files" do
|
184
|
-
begin
|
185
|
-
root = "/tmp/test-find_tests-#{rand(999)}"
|
186
|
-
`mkdir #{root}`
|
187
|
-
`mkdir #{root}/a`
|
188
|
-
`mkdir #{root}/b`
|
189
|
-
`touch #{root}/x_test.rb`
|
190
|
-
`touch #{root}/a/x_test.rb`
|
191
|
-
`touch #{root}/a/test.rb`
|
192
|
-
`touch #{root}/b/y_test.rb`
|
193
|
-
`touch #{root}/b/test.rb`
|
194
|
-
`ln -s #{root}/b #{root}/c`
|
195
|
-
`ln -s #{root}/b #{root}/a/`
|
196
|
-
ParallelTests.send(:find_tests, root).sort.should == [
|
197
|
-
"#{root}/a/b/y_test.rb",
|
198
|
-
"#{root}/a/x_test.rb",
|
199
|
-
"#{root}/b/y_test.rb",
|
200
|
-
"#{root}/c/y_test.rb",
|
201
|
-
"#{root}/x_test.rb"
|
202
|
-
]
|
203
|
-
ensure
|
204
|
-
`rm -rf #{root}`
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
it "finds files by pattern" do
|
209
|
-
begin
|
210
|
-
root = "/tmp/test-find_tests-#{rand(999)}"
|
211
|
-
`mkdir #{root}`
|
212
|
-
`mkdir #{root}/a`
|
213
|
-
`touch #{root}/a/x_test.rb`
|
214
|
-
`touch #{root}/a/y_test.rb`
|
215
|
-
`touch #{root}/a/z_test.rb`
|
216
|
-
ParallelTests.send(:find_tests, root, :pattern => '^a/(y|z)_test').sort.should == [
|
217
|
-
"#{root}/a/y_test.rb",
|
218
|
-
"#{root}/a/z_test.rb",
|
219
|
-
]
|
220
|
-
ensure
|
221
|
-
`rm -rf #{root}`
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
describe :summarize_results do
|
227
|
-
it "adds results" do
|
228
|
-
ParallelTests.summarize_results(['1 foo 3 bar','2 foo 5 bar']).should == '8 bars, 3 foos'
|
229
|
-
end
|
230
|
-
|
231
|
-
it "adds results with braces" do
|
232
|
-
ParallelTests.summarize_results(['1 foo(s) 3 bar(s)','2 foo 5 bar']).should == '8 bars, 3 foos'
|
233
|
-
end
|
234
|
-
|
235
|
-
it "adds same results with plurals" do
|
236
|
-
ParallelTests.summarize_results(['1 foo 3 bar','2 foos 5 bar']).should == '8 bars, 3 foos'
|
237
|
-
end
|
238
|
-
|
239
|
-
it "adds non-similar results" do
|
240
|
-
ParallelTests.summarize_results(['1 xxx 2 yyy','1 xxx 2 zzz']).should == '2 xxxs, 2 yyys, 2 zzzs'
|
241
|
-
end
|
242
|
-
|
243
|
-
it "does not pluralize 1" do
|
244
|
-
ParallelTests.summarize_results(['1 xxx 2 yyy']).should == '1 xxx, 2 yyys'
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
92
|
it "has a version" do
|
249
|
-
ParallelTests::VERSION.should =~ /^\d+\.\d+\.\d
|
93
|
+
ParallelTests::VERSION.should =~ /^\d+\.\d+\.\d+/
|
250
94
|
end
|
251
95
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
# ---- requirements
|
2
1
|
$LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
|
3
|
-
require 'rubygems'
|
4
2
|
|
5
3
|
FAKE_RAILS_ROOT = '/tmp/pspecs/fixtures'
|
6
4
|
|
7
5
|
require 'tempfile'
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
|
12
|
-
require 'parallel_tests/
|
6
|
+
require 'parallel_tests'
|
7
|
+
require 'parallel_tests/test/runner'
|
8
|
+
require 'parallel_tests/test/runtime_logger'
|
9
|
+
|
10
|
+
require 'parallel_tests/spec/runner'
|
11
|
+
require 'parallel_tests/spec/runtime_logger'
|
12
|
+
require 'parallel_tests/spec/summary_logger'
|
13
|
+
|
14
|
+
require 'parallel_tests/cucumber/runner'
|
13
15
|
|
14
16
|
OutputLogger = Struct.new(:output) do
|
15
17
|
attr_reader :flock, :flush
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.0.alpha
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Michael Grosser
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
16
|
-
requirement: &
|
16
|
+
requirement: &16612760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,9 +21,9 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16612760
|
25
25
|
description:
|
26
|
-
email:
|
26
|
+
email: michael@grosser.it
|
27
27
|
executables:
|
28
28
|
- parallel_cucumber
|
29
29
|
- parallel_spec
|
@@ -31,39 +31,43 @@ executables:
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- .gitignore
|
34
35
|
- Gemfile
|
35
36
|
- Gemfile.lock
|
36
37
|
- Rakefile
|
37
38
|
- Readme.md
|
38
|
-
- VERSION
|
39
39
|
- bin/parallel_cucumber
|
40
40
|
- bin/parallel_spec
|
41
41
|
- bin/parallel_test
|
42
|
-
- lib/parallel_cucumber.rb
|
43
|
-
- lib/parallel_cucumber/runtime_logger.rb
|
44
|
-
- lib/parallel_specs.rb
|
45
|
-
- lib/parallel_specs/spec_failures_logger.rb
|
46
|
-
- lib/parallel_specs/spec_logger_base.rb
|
47
|
-
- lib/parallel_specs/spec_runtime_logger.rb
|
48
|
-
- lib/parallel_specs/spec_summary_logger.rb
|
49
42
|
- lib/parallel_tests.rb
|
43
|
+
- lib/parallel_tests/cli.rb
|
44
|
+
- lib/parallel_tests/cucumber/runner.rb
|
45
|
+
- lib/parallel_tests/cucumber/runtime_logger.rb
|
50
46
|
- lib/parallel_tests/grouper.rb
|
51
47
|
- lib/parallel_tests/railtie.rb
|
52
|
-
- lib/parallel_tests/
|
48
|
+
- lib/parallel_tests/spec/failures_logger.rb
|
49
|
+
- lib/parallel_tests/spec/logger_base.rb
|
50
|
+
- lib/parallel_tests/spec/runner.rb
|
51
|
+
- lib/parallel_tests/spec/runtime_logger.rb
|
52
|
+
- lib/parallel_tests/spec/summary_logger.rb
|
53
53
|
- lib/parallel_tests/tasks.rb
|
54
|
-
- lib/
|
54
|
+
- lib/parallel_tests/test/runner.rb
|
55
|
+
- lib/parallel_tests/test/runtime_logger.rb
|
56
|
+
- lib/parallel_tests/version.rb
|
55
57
|
- parallel_tests.gemspec
|
56
58
|
- spec/integration_spec.rb
|
57
|
-
- spec/
|
58
|
-
- spec/
|
59
|
-
- spec/
|
60
|
-
- spec/
|
61
|
-
- spec/
|
62
|
-
- spec/parallel_tests/
|
59
|
+
- spec/parallel_tests/cucumber/runner_spec.rb
|
60
|
+
- spec/parallel_tests/spec/failure_logger_spec.rb
|
61
|
+
- spec/parallel_tests/spec/runner_spec.rb
|
62
|
+
- spec/parallel_tests/spec/runtime_logger_spec.rb
|
63
|
+
- spec/parallel_tests/spec/summary_logger_spec.rb
|
64
|
+
- spec/parallel_tests/test/runner_spec.rb
|
65
|
+
- spec/parallel_tests/test/runtime_logger_spec.rb
|
63
66
|
- spec/parallel_tests_spec.rb
|
64
67
|
- spec/spec_helper.rb
|
65
68
|
homepage: http://github.com/grosser/parallel_tests
|
66
|
-
licenses:
|
69
|
+
licenses:
|
70
|
+
- MIT
|
67
71
|
post_install_message:
|
68
72
|
rdoc_options: []
|
69
73
|
require_paths:
|
@@ -76,13 +80,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
80
|
version: '0'
|
77
81
|
segments:
|
78
82
|
- 0
|
79
|
-
hash: -
|
83
|
+
hash: -20791927037817869
|
80
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
85
|
none: false
|
82
86
|
requirements:
|
83
|
-
- - ! '
|
87
|
+
- - ! '>'
|
84
88
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
89
|
+
version: 1.3.1
|
86
90
|
requirements: []
|
87
91
|
rubyforge_project:
|
88
92
|
rubygems_version: 1.8.15
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.6.20
|
data/lib/parallel_cucumber.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'parallel_tests'
|
2
|
-
|
3
|
-
class ParallelCucumber < ParallelTests
|
4
|
-
def self.run_tests(test_files, process_number, options)
|
5
|
-
color = ($stdout.tty? ? 'AUTOTEST=1 ; export AUTOTEST ;' : '')#display color when we are in a terminal
|
6
|
-
runtime_logging = " --format ParallelCucumber::RuntimeLogger --out #{runtime_log}"
|
7
|
-
cmd = "#{color} #{executable}"
|
8
|
-
cmd << runtime_logging if File.directory?(File.dirname(runtime_log))
|
9
|
-
cmd << " #{options[:test_options]} #{test_files*' '}"
|
10
|
-
execute_command(cmd, process_number, options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.executable
|
14
|
-
if bundler_enabled?
|
15
|
-
"bundle exec cucumber"
|
16
|
-
elsif File.file?("script/cucumber")
|
17
|
-
"script/cucumber"
|
18
|
-
else
|
19
|
-
"cucumber"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.runtime_log
|
24
|
-
'tmp/parallel_runtime_cucumber.log'
|
25
|
-
end
|
26
|
-
|
27
|
-
protected
|
28
|
-
|
29
|
-
def self.test_suffix
|
30
|
-
".feature"
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.line_is_result?(line)
|
34
|
-
line =~ /^\d+ (steps|scenarios)/
|
35
|
-
end
|
36
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
class ParallelCucumber
|
2
|
-
class RuntimeLogger
|
3
|
-
|
4
|
-
def initialize(step_mother, path_or_io, options=nil)
|
5
|
-
@io = prepare_io(path_or_io)
|
6
|
-
@example_times = Hash.new(0)
|
7
|
-
end
|
8
|
-
|
9
|
-
def before_feature(_)
|
10
|
-
@start_at = Time.now.to_f
|
11
|
-
end
|
12
|
-
|
13
|
-
def after_feature(feature)
|
14
|
-
@example_times[feature.file] += Time.now.to_f - @start_at
|
15
|
-
end
|
16
|
-
|
17
|
-
def after_features(*args)
|
18
|
-
lock_output do
|
19
|
-
@io.puts @example_times.map { |file, time| "#{file}:#{time}" }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def prepare_io(path_or_io)
|
26
|
-
if path_or_io.respond_to?(:write)
|
27
|
-
path_or_io
|
28
|
-
else # its a path
|
29
|
-
File.open(path_or_io, 'w').close # clean out the file
|
30
|
-
file = File.open(path_or_io, 'a')
|
31
|
-
|
32
|
-
at_exit do
|
33
|
-
unless file.closed?
|
34
|
-
file.flush
|
35
|
-
file.close
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
file
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# do not let multiple processes get in each others way
|
44
|
-
def lock_output
|
45
|
-
if File === @io
|
46
|
-
begin
|
47
|
-
@io.flock File::LOCK_EX
|
48
|
-
yield
|
49
|
-
ensure
|
50
|
-
@io.flock File::LOCK_UN
|
51
|
-
end
|
52
|
-
else
|
53
|
-
yield
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|