parallel_tests 2.21.3 → 4.2.1
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.
- checksums.yaml +4 -4
- data/Readme.md +73 -39
- data/bin/parallel_cucumber +2 -1
- data/bin/parallel_rspec +2 -1
- data/bin/parallel_spinach +2 -1
- data/bin/parallel_test +2 -1
- data/lib/parallel_tests/cli.rb +188 -100
- data/lib/parallel_tests/cucumber/failures_logger.rb +1 -1
- data/lib/parallel_tests/cucumber/features_with_steps.rb +32 -0
- data/lib/parallel_tests/cucumber/runner.rb +10 -7
- data/lib/parallel_tests/cucumber/scenario_line_logger.rb +18 -15
- data/lib/parallel_tests/cucumber/scenarios.rb +34 -36
- data/lib/parallel_tests/gherkin/io.rb +2 -3
- data/lib/parallel_tests/gherkin/listener.rb +10 -12
- data/lib/parallel_tests/gherkin/runner.rb +29 -35
- data/lib/parallel_tests/gherkin/runtime_logger.rb +13 -12
- data/lib/parallel_tests/grouper.rb +88 -28
- data/lib/parallel_tests/pids.rb +6 -5
- data/lib/parallel_tests/railtie.rb +1 -0
- data/lib/parallel_tests/rspec/failures_logger.rb +2 -2
- data/lib/parallel_tests/rspec/logger_base.rb +9 -7
- data/lib/parallel_tests/rspec/runner.rb +32 -24
- data/lib/parallel_tests/rspec/runtime_logger.rb +12 -11
- data/lib/parallel_tests/rspec/summary_logger.rb +2 -3
- data/lib/parallel_tests/spinach/runner.rb +6 -2
- data/lib/parallel_tests/tasks.rb +153 -65
- data/lib/parallel_tests/test/runner.rb +114 -49
- data/lib/parallel_tests/test/runtime_logger.rb +18 -47
- data/lib/parallel_tests/version.rb +2 -1
- data/lib/parallel_tests.rb +14 -19
- metadata +15 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9044c95c595a48f89a621563c609a4c9fa89d851792ca694a30fcaf947a2119
|
4
|
+
data.tar.gz: 248e38e467b9070c1666819e2c1dc9149b791644b42e8a90cd53df82ebb80eed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363e8d317a43d03043a270c19d05f60071bd05a9b435a0545454e81b96d875b694dd4fadc74669ba136990d57d863883132a19ff7fd1c9c4169e2c16a8e2db38
|
7
|
+
data.tar.gz: ef251fa00adf1310c5281ee4985119ce6b4810d121d87a3a4a7f6b6a03aa968ed9be7847eec127e74a118983e4454b181635d1538b1a17b5f242fbb11839caa9
|
data/Readme.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# parallel_tests
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/parallel_tests)
|
4
|
-
[](https://ci.appveyor.com/project/grosser/parallel-tests)
|
4
|
+
[](https://github.com/grosser/parallel_tests/actions?query=workflow%3Atest)
|
6
5
|
|
7
6
|
Speedup Test::Unit + RSpec + Cucumber + Spinach by running parallel on multiple CPU cores.<br/>
|
8
7
|
ParallelTests splits tests into even groups (by number of lines or runtime) and runs each group in a single process with its own database.
|
@@ -37,9 +36,15 @@ test:
|
|
37
36
|
### Copy development schema (repeat after migrations)
|
38
37
|
rake parallel:prepare
|
39
38
|
|
39
|
+
### Run migrations in additional database(s) (repeat after migrations)
|
40
|
+
rake parallel:migrate
|
41
|
+
|
40
42
|
### Setup environment from scratch (create db and loads schema, useful for CI)
|
41
43
|
rake parallel:setup
|
42
44
|
|
45
|
+
### Drop all test databases
|
46
|
+
rake parallel:drop
|
47
|
+
|
43
48
|
### Run!
|
44
49
|
rake parallel:test # Test::Unit
|
45
50
|
rake parallel:spec # RSpec
|
@@ -82,6 +87,8 @@ Running things once
|
|
82
87
|
===================
|
83
88
|
|
84
89
|
```Ruby
|
90
|
+
require "parallel_tests"
|
91
|
+
|
85
92
|
# preparation:
|
86
93
|
# affected by race-condition: first process may boot slower than the second
|
87
94
|
# either sleep a bit or use a lock for example File.lock
|
@@ -97,7 +104,6 @@ at_exit do
|
|
97
104
|
undo_something
|
98
105
|
end
|
99
106
|
end
|
100
|
-
|
101
107
|
```
|
102
108
|
|
103
109
|
Even test group run-times
|
@@ -113,9 +119,9 @@ Rspec: Add to your `.rspec_parallel` (or `.rspec`) :
|
|
113
119
|
--format progress
|
114
120
|
--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log
|
115
121
|
|
116
|
-
To use a custom logfile location (default: `tmp/
|
122
|
+
To use a custom logfile location (default: `tmp/parallel_runtime_rspec.log`), use the CLI: `parallel_test spec -t rspec --runtime-log my.log`
|
117
123
|
|
118
|
-
###
|
124
|
+
### Minitest
|
119
125
|
|
120
126
|
Add to your `test_helper.rb`:
|
121
127
|
```ruby
|
@@ -141,17 +147,19 @@ Add the following to your `.rspec_parallel` (or `.rspec`) :
|
|
141
147
|
RSpec: FailuresLogger
|
142
148
|
-----------------------
|
143
149
|
|
144
|
-
Produce
|
150
|
+
Produce pastable command-line snippets for each failed example. For example:
|
145
151
|
|
146
|
-
|
147
|
-
|
148
|
-
|
152
|
+
```bash
|
153
|
+
rspec /path/to/my_spec.rb:123 # should do something
|
154
|
+
```
|
149
155
|
|
150
|
-
Add
|
156
|
+
Add to `.rspec_parallel` or use as CLI flag:
|
151
157
|
|
152
158
|
--format progress
|
153
159
|
--format ParallelTests::RSpec::FailuresLogger --out tmp/failing_specs.log
|
154
160
|
|
161
|
+
(Not needed to retry failures, for that pass [--only-failures](https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures) to rspec)
|
162
|
+
|
155
163
|
Cucumber: FailuresLogger
|
156
164
|
-----------------------
|
157
165
|
|
@@ -176,42 +184,57 @@ Setup for non-rails
|
|
176
184
|
|
177
185
|
gem install parallel_tests
|
178
186
|
# go to your project dir
|
179
|
-
parallel_test
|
180
|
-
parallel_rspec
|
181
|
-
parallel_cucumber
|
182
|
-
parallel_spinach
|
187
|
+
parallel_test
|
188
|
+
parallel_rspec
|
189
|
+
parallel_cucumber
|
190
|
+
parallel_spinach
|
191
|
+
|
192
|
+
- use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc. (docker compose: expose it)
|
183
193
|
|
184
|
-
-
|
185
|
-
- Only run selected files & folders:
|
194
|
+
- Only run a subset of files / folders:
|
186
195
|
|
187
196
|
`parallel_test test/bar test/baz/foo_text.rb`
|
188
197
|
|
189
198
|
- Pass test-options and files via `--`:
|
190
199
|
|
191
|
-
`
|
200
|
+
`parallel_rspec -- -t acceptance -f progress -- spec/foo_spec.rb spec/acceptance`
|
201
|
+
|
202
|
+
- Pass in test options, by using the -o flag (wrap everything in quotes):
|
203
|
+
|
204
|
+
`parallel_cucumber -n 2 -o '-p foo_profile --tags @only_this_tag or @only_that_tag --format summary'`
|
192
205
|
|
193
206
|
Options are:
|
194
207
|
<!-- copy output from bundle exec ./bin/parallel_test -h -->
|
195
|
-
|
196
208
|
-n [PROCESSES] How many processes to use, default: available CPUs
|
197
209
|
-p, --pattern [PATTERN] run tests matching this regex pattern
|
210
|
+
--exclude-pattern [PATTERN] exclude tests matching this regex pattern
|
198
211
|
--group-by [TYPE] group tests by:
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
212
|
+
found - order of finding files
|
213
|
+
steps - number of cucumber/spinach steps
|
214
|
+
scenarios - individual cucumber scenarios
|
215
|
+
filesize - by size of the file
|
216
|
+
runtime - info from runtime log
|
217
|
+
default - runtime when runtime log is filled otherwise filesize
|
205
218
|
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
|
206
219
|
-s, --single [PATTERN] Run all matching files in the same process
|
207
220
|
-i, --isolate Do not run any other tests in the group used by --single(-s)
|
208
|
-
--
|
221
|
+
--isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1.
|
222
|
+
--highest-exit-status Exit with the highest exit status provided by test run(s)
|
223
|
+
--specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
|
224
|
+
processes in a specific formation. Commas indicate specs in the same process,
|
225
|
+
pipes indicate specs in a new process. Cannot use with --single, --isolate, or
|
226
|
+
--isolate-n. Ex.
|
227
|
+
$ parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
|
228
|
+
Process 1 will contain 1_spec.rb and 2_spec.rb
|
229
|
+
Process 2 will contain 3_spec.rb
|
230
|
+
Process 3 will contain all other specs
|
231
|
+
--only-group INT[,INT]
|
209
232
|
-e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUMBER']
|
210
233
|
-o, --test-options '[OPTIONS]' execute test commands with those options
|
211
234
|
-t, --type [TYPE] test(default) / rspec / cucumber / spinach
|
212
235
|
--suffix [PATTERN] override built in test file pattern (should match suffix):
|
213
|
-
|
214
|
-
|
236
|
+
'_spec.rb$' - matches rspec files
|
237
|
+
'_(test|spec).rb$' - matches test or spec files
|
215
238
|
--serialize-stdout Serialize stdout output, nothing will be written until everything is done
|
216
239
|
--prefix-output-with-test-env-number
|
217
240
|
Prefixes test env number to the output when not using --serialize-stdout
|
@@ -221,9 +244,13 @@ Options are:
|
|
221
244
|
--ignore-tags [PATTERN] When counting steps ignore scenarios with tags that match this pattern
|
222
245
|
--nice execute test commands with low priority.
|
223
246
|
--runtime-log [PATH] Location of previously recorded test runtimes
|
224
|
-
--allowed-missing
|
247
|
+
--allowed-missing [INT] Allowed percentage of missing runtimes (default = 50)
|
225
248
|
--unknown-runtime [FLOAT] Use given number as unknown runtime (otherwise use average time)
|
226
|
-
--
|
249
|
+
--first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
|
250
|
+
--fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
|
251
|
+
--verbose Print debug output
|
252
|
+
--verbose-command Displays the command that will be executed by each process and when there are failures displays the command executed by each process that failed
|
253
|
+
--quiet Print only tests output
|
227
254
|
-v, --version Show Version
|
228
255
|
-h, --help Show this.
|
229
256
|
|
@@ -252,6 +279,7 @@ TIPS
|
|
252
279
|
- Instantly see failures (instead of just a red F) with [rspec-instafail](https://github.com/grosser/rspec-instafail)
|
253
280
|
- Use [rspec-retry](https://github.com/NoRedInk/rspec-retry) (not rspec-rerun) to rerun failed tests.
|
254
281
|
- [JUnit formatter configuration](https://github.com/grosser/parallel_tests/wiki#with-rspec_junit_formatter----by-jgarber)
|
282
|
+
- Use [parallel_split_test](https://github.com/grosser/parallel_split_test) to run multiple scenarios in a single spec file, concurrently. (`parallel_tests` [works at the file-level and intends to stay that way](https://github.com/grosser/parallel_tests/issues/747#issuecomment-580216980))
|
255
283
|
|
256
284
|
### Cucumber
|
257
285
|
|
@@ -262,30 +290,23 @@ TIPS
|
|
262
290
|
- Builds a HTML report from JSON with support for debug msgs & embedded Base64 images.
|
263
291
|
|
264
292
|
### General
|
265
|
-
- [SQL schema format] use :ruby schema format to get faster parallel:prepare`
|
266
293
|
- [ZSH] use quotes to use rake arguments `rake "parallel:prepare[3]"`
|
267
294
|
- [Memcached] use different namespaces<br/>
|
268
295
|
e.g. `config.cache_store = ..., namespace: "test_#{ENV['TEST_ENV_NUMBER']}"`
|
269
296
|
- Debug errors that only happen with multiple files using `--verbose` and [cleanser](https://github.com/grosser/cleanser)
|
270
297
|
- `export PARALLEL_TEST_PROCESSORS=13` to override default processor count
|
271
298
|
- Shell alias: `alias prspec='parallel_rspec -m 2 --'`
|
272
|
-
- [Spring]
|
299
|
+
- [Spring] Add the [spring-commands-parallel-tests](https://github.com/DocSpring/spring-commands-parallel-tests) gem to your `Gemfile` to get `parallel_tests` working with Spring.
|
273
300
|
- `--first-is-1` will make the first environment be `1`, so you can test while running your full suite.<br/>
|
274
301
|
`export PARALLEL_TEST_FIRST_IS_1=true` will provide the same result
|
275
302
|
- [email_spec and/or action_mailer_cache_delivery](https://github.com/grosser/parallel_tests/wiki)
|
276
303
|
- [zeus-parallel_tests](https://github.com/sevos/zeus-parallel_tests)
|
277
|
-
- [Distributed
|
304
|
+
- [Distributed Parallel Tests on CI systems)](https://github.com/grosser/parallel_tests/wiki/Distributed-Parallel-Tests-on-CI-systems) learn how `parallel_tests` can run on distributed servers such as Travis and GitLab-CI. Also shows you how to use parallel_tests without adding `TEST_ENV_NUMBER`-backends
|
278
305
|
- [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
|
279
306
|
- [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
|
280
307
|
- [Capistrano setup](https://github.com/grosser/parallel_tests/wiki/Remotely-with-capistrano) let your tests run on a big box instead of your laptop
|
281
308
|
|
282
|
-
Contribute your own
|
283
|
-
|
284
|
-
TODO
|
285
|
-
====
|
286
|
-
- fix tests vs cucumber >= 1.2 `unknown option --format`
|
287
|
-
- add unit tests for cucumber runtime formatter
|
288
|
-
- fix windows bugs / get windows CI green
|
309
|
+
Contribute your own gotchas to the [Wiki](https://github.com/grosser/parallel_tests/wiki) or even better open a PR :)
|
289
310
|
|
290
311
|
Authors
|
291
312
|
====
|
@@ -369,6 +390,19 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
|
|
369
390
|
- [Aleksei Gusev](https://github.com/hron)
|
370
391
|
- [Scott Olsen](https://github.com/scottolsen)
|
371
392
|
- [Andrei Botalov](https://github.com/abotalov)
|
393
|
+
- [Zachary Attas](https://github.com/snackattas)
|
394
|
+
- [David Rodríguez](https://github.com/deivid-rodriguez)
|
395
|
+
- [Justin Doody](https://github.com/justindoody)
|
396
|
+
- [Sandeep Singh](https://github.com/sandeepnagra)
|
397
|
+
- [Calaway](https://github.com/calaway)
|
398
|
+
- [alboyadjian](https://github.com/alboyadjian)
|
399
|
+
- [Nathan Broadbent](https://github.com/ndbroadbent)
|
400
|
+
- [Vikram B Kumar](https://github.com/v-kumar)
|
401
|
+
- [Joshua Pinter](https://github.com/joshuapinter)
|
402
|
+
- [Zach Dennis](https://github.com/zdennis)
|
403
|
+
- [Jon Dufresne](https://github.com/jdufresne)
|
404
|
+
- [Eric Kessler](https://github.com/enkessler)
|
405
|
+
- [Adis Osmonov](https://github.com/adis-io)
|
372
406
|
|
373
407
|
[Michael Grosser](http://grosser.it)<br/>
|
374
408
|
michael@grosser.it<br/>
|
data/bin/parallel_cucumber
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# enable local usage from cloned repo
|
4
|
-
root = File.expand_path(
|
5
|
+
root = File.expand_path('..', __dir__)
|
5
6
|
$LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
|
6
7
|
|
7
8
|
require "parallel_tests"
|
data/bin/parallel_rspec
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# enable local usage from cloned repo
|
4
|
-
root = File.expand_path(
|
5
|
+
root = File.expand_path('..', __dir__)
|
5
6
|
$LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
|
6
7
|
|
7
8
|
require "parallel_tests"
|
data/bin/parallel_spinach
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# enable local usage from cloned repo
|
4
|
-
root = File.expand_path(
|
5
|
+
root = File.expand_path('..', __dir__)
|
5
6
|
$LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
|
6
7
|
|
7
8
|
require "parallel_tests"
|
data/bin/parallel_test
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# enable local usage from cloned repo
|
4
|
-
root = File.expand_path(
|
5
|
+
root = File.expand_path('..', __dir__)
|
5
6
|
$LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
|
6
7
|
|
7
8
|
require "parallel_tests"
|