parallel_tests 0.7.2 → 0.7.3
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.
- data/Gemfile.lock +1 -1
- data/Readme.md +21 -24
- data/lib/parallel_tests/cucumber/runner.rb +15 -3
- data/lib/parallel_tests/version.rb +1 -1
- data/spec/parallel_tests/cucumber/runner_spec.rb +22 -0
- metadata +6 -6
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -7,7 +7,7 @@ Setup for Rails
|
|
7
7
|
===============
|
8
8
|
[still using Rails 2?](https://github.com/grosser/parallel_tests/blob/master/ReadmeRails2.md)
|
9
9
|
|
10
|
-
|
10
|
+
### Install
|
11
11
|
If you use RSpec: ensure you got >= 2.4
|
12
12
|
|
13
13
|
As gem
|
@@ -22,21 +22,19 @@ OR as plugin
|
|
22
22
|
# add to Gemfile
|
23
23
|
gem "parallel", :group => :development
|
24
24
|
|
25
|
-
|
25
|
+
### Add to `config/database.yml`
|
26
26
|
ParallelTests uses 1 database per test-process, 2 processes will use `*_test` and `*_test2`.
|
27
27
|
|
28
|
-
|
29
|
-
### 1: Add to `config/database.yml`
|
30
28
|
test:
|
31
29
|
database: yourproject_test<%= ENV['TEST_ENV_NUMBER'] %>
|
32
30
|
|
33
|
-
###
|
31
|
+
### Create additional database(s)
|
34
32
|
rake parallel:create
|
35
33
|
|
36
|
-
###
|
34
|
+
### Copy development schema (repeat after migrations)
|
37
35
|
rake parallel:prepare
|
38
36
|
|
39
|
-
###
|
37
|
+
### Run!
|
40
38
|
rake parallel:test # Test::Unit
|
41
39
|
rake parallel:spec # RSpec
|
42
40
|
rake parallel:features # Cucumber
|
@@ -53,8 +51,8 @@ Test by pattern (e.g. use one integration server per subfolder / see if you brok
|
|
53
51
|
rake parallel:test['user|product'] # run user and product related tests
|
54
52
|
|
55
53
|
|
56
|
-
Example output
|
57
|
-
|
54
|
+
### Example output
|
55
|
+
|
58
56
|
2 processes for 210 specs, ~ 105 specs per process
|
59
57
|
... test output ...
|
60
58
|
|
@@ -72,29 +70,27 @@ Log test runtime to give each process the same runtime.
|
|
72
70
|
|
73
71
|
Rspec: Add to your `.rspec_parallel` (or `.rspec`) :
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
|
73
|
+
If installed as plugin: -I vendor/plugins/parallel_tests/lib
|
74
|
+
--format progress
|
75
|
+
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
|
79
76
|
|
80
77
|
Test::Unit: Add to your `test_helper.rb`:
|
81
78
|
|
82
79
|
require 'parallel_tests/test/runtime_logger'
|
83
80
|
|
84
81
|
|
85
|
-
|
82
|
+
RSpec: SummaryLogger
|
86
83
|
--------------------
|
87
84
|
|
88
85
|
This logger logs the test output without the different processes overwriting each other.
|
89
86
|
|
90
87
|
Add the following to your `.rspec_parallel` (or `.rspec`) :
|
91
88
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
--format ParallelTests::RSpec::SummaryLogger --out tmp/spec_summary.log
|
89
|
+
If installed as plugin: -I vendor/plugins/parallel_tests/lib
|
90
|
+
--format progress
|
91
|
+
--format ParallelTests::RSpec::SummaryLogger --out tmp/spec_summary.log
|
96
92
|
|
97
|
-
|
93
|
+
RSpec: FailuresLogger
|
98
94
|
-----------------------
|
99
95
|
|
100
96
|
This logger produces pasteable command-line snippets for each failed example.
|
@@ -105,10 +101,9 @@ E.g.
|
|
105
101
|
|
106
102
|
Add the following to your `.rspec_parallel` (or `.rspec`) :
|
107
103
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
--format ParallelTests::RSpec::FailuresLogger --out tmp/failing_specs.log
|
104
|
+
If installed as plugin: -I vendor/plugins/parallel_tests/lib
|
105
|
+
--format progress
|
106
|
+
--format ParallelTests::RSpec::FailuresLogger --out tmp/failing_specs.log
|
112
107
|
|
113
108
|
Setup for non-rails
|
114
109
|
===================
|
@@ -156,7 +151,7 @@ TIPS
|
|
156
151
|
- [Capybara + Selenium] add to env.rb: `Capybara.server_port = 8888 + ENV['TEST_ENV_NUMBER'].to_i`
|
157
152
|
- [RSpec] add a `.rspec_parallel` to use different options, e.g. **no --drb**
|
158
153
|
- [RSpec] delete `script/spec`
|
159
|
-
- [RSpec] [spork](https://github.com/
|
154
|
+
- [RSpec] [spork](https://github.com/sporkrb/spork) does not work in parallel
|
160
155
|
- [RSpec] remove --loadby from you spec/*.opts
|
161
156
|
- [RSpec] Instantly see failures (instead of just a red F) with [rspec-instafail](https://github.com/grosser/rspec-instafail)
|
162
157
|
- [Bundler] if you have a `Gemfile` then `bundle exec` will be used to run tests
|
@@ -167,6 +162,7 @@ TIPS
|
|
167
162
|
- [ActiveRecord] if you do not have `db:abort_if_pending_migrations` add this to your Rakefile: `task('db:abort_if_pending_migrations'){}`
|
168
163
|
- `export PARALLEL_TEST_PROCESSORS=X` in your environment and parallel_tests will use this number of processors by default
|
169
164
|
- [ZSH] use quotes to use rake arguments `rake "parallel:prepare[3]"`
|
165
|
+
- [email_spec and/or action_mailer_cache_delivery](https://github.com/grosser/parallel_tests/wiki)
|
170
166
|
|
171
167
|
TODO
|
172
168
|
====
|
@@ -207,6 +203,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
207
203
|
- [Lawrence Wang](https://github.com/levity)
|
208
204
|
- [Potapov Sergey](https://github.com/greyblake)
|
209
205
|
- [Łukasz Tackowiak](https://github.com/lukasztackowiak)
|
206
|
+
- [Pedro Carriço](https://github.com/pedrocarrico)
|
210
207
|
|
211
208
|
[Michael Grosser](http://grosser.it)<br/>
|
212
209
|
michael@grosser.it<br/>
|
@@ -6,9 +6,14 @@ module ParallelTests
|
|
6
6
|
def self.run_tests(test_files, process_number, options)
|
7
7
|
color = ($stdout.tty? ? 'AUTOTEST=1 ; export AUTOTEST ;' : '')#display color when we are in a terminal
|
8
8
|
runtime_logging = " --format ParallelTests::Cucumber::RuntimeLogger --out #{runtime_log}"
|
9
|
-
cmd =
|
10
|
-
|
11
|
-
|
9
|
+
cmd = [
|
10
|
+
color,
|
11
|
+
executable,
|
12
|
+
(runtime_logging if File.directory?(File.dirname(runtime_log))),
|
13
|
+
options[:test_options],
|
14
|
+
cucumber_opts,
|
15
|
+
*test_files
|
16
|
+
].compact.join(" ")
|
12
17
|
execute_command(cmd, process_number, options)
|
13
18
|
end
|
14
19
|
|
@@ -37,6 +42,13 @@ module ParallelTests
|
|
37
42
|
def self.line_is_result?(line)
|
38
43
|
line =~ /^\d+ (steps|scenarios)/
|
39
44
|
end
|
45
|
+
|
46
|
+
def self.cucumber_opts
|
47
|
+
config = 'config/cucumber.yml'
|
48
|
+
if File.exists?(config) && File.read(config) =~ /^parallel:/
|
49
|
+
"--profile parallel"
|
50
|
+
end
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
42
54
|
end
|
@@ -52,6 +52,28 @@ describe ParallelTests::Cucumber do
|
|
52
52
|
ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* -p default}}.and_return mocked_process
|
53
53
|
call(['xxx'],1,:test_options => '-p default')
|
54
54
|
end
|
55
|
+
|
56
|
+
it "uses parallel profile if config/cucumber.yml contains it" do
|
57
|
+
file_contents = 'parallel: -f progress'
|
58
|
+
ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* foo bar --profile parallel}}.and_return mocked_process
|
59
|
+
File.should_receive(:exists?).with('config/cucumber.yml').and_return true
|
60
|
+
File.should_receive(:read).with('config/cucumber.yml').and_return file_contents
|
61
|
+
call(['xxx'],1, :test_options => 'foo bar')
|
62
|
+
end
|
63
|
+
|
64
|
+
it "does not use parallel profile if config/cucumber.yml does not contain it" do
|
65
|
+
file_contents = 'blob: -f progress'
|
66
|
+
ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .* foo bar}}.and_return mocked_process
|
67
|
+
File.should_receive(:exists?).with('config/cucumber.yml').and_return true
|
68
|
+
File.should_receive(:read).with('config/cucumber.yml').and_return file_contents
|
69
|
+
call(['xxx'],1,:test_options => 'foo bar')
|
70
|
+
end
|
71
|
+
|
72
|
+
it "does not use the parallel profile if config/cucumber.yml does not exist" do
|
73
|
+
ParallelTests::Cucumber::Runner.should_receive(:open).with{|x,y| x =~ %r{script/cucumber .*}}.and_return mocked_process
|
74
|
+
File.should_receive(:exists?).with('config/cucumber.yml').and_return false
|
75
|
+
call(['xxx'],1,{})
|
76
|
+
end
|
55
77
|
end
|
56
78
|
|
57
79
|
describe :find_results do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03
|
12
|
+
date: 2012-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
16
|
-
requirement: &
|
16
|
+
requirement: &22437320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22437320
|
25
25
|
description:
|
26
26
|
email: michael@grosser.it
|
27
27
|
executables:
|
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
segments:
|
83
83
|
- 0
|
84
|
-
hash:
|
84
|
+
hash: 1971171336548076619
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash:
|
93
|
+
hash: 1971171336548076619
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
96
|
rubygems_version: 1.8.15
|