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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf77da70ec28df90a21b90572420fadab460301e3ec1478a0cffd3e60921e075
4
- data.tar.gz: 47bd7a45257b1bda6b5d6aab216d97962619876f9fd3c8600ba4ef06d2e1a32a
3
+ metadata.gz: a9044c95c595a48f89a621563c609a4c9fa89d851792ca694a30fcaf947a2119
4
+ data.tar.gz: 248e38e467b9070c1666819e2c1dc9149b791644b42e8a90cd53df82ebb80eed
5
5
  SHA512:
6
- metadata.gz: 93c5b2c81652075847d8ec76e3e618a207adc20df5cafcc5328c0e7920f9bf5a0f1e6ddc0b2256dec6c282c06227992958179096c952033d6874933f7aa384d7
7
- data.tar.gz: 4b7bd0ec398dd38a681eb0ef7c2849740b54dc00cf52dad144dccfaec5b7faeaa2edabb1d2704cdb3071193b9200d5515bd8ef492bc73cd81860e08f09010cf8
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
  [![Gem Version](https://badge.fury.io/rb/parallel_tests.svg)](https://rubygems.org/gems/parallel_tests)
4
- [![Build Status](https://travis-ci.org/grosser/parallel_tests.svg)](https://travis-ci.org/grosser/parallel_tests/builds)
5
- [![Build status](https://ci.appveyor.com/api/projects/status/708b1up4pqc34x3y?svg=true)](https://ci.appveyor.com/project/grosser/parallel-tests)
4
+ [![Build status](https://github.com/grosser/parallel_tests/workflows/test/badge.svg)](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/parallel_runtime_spec.log`), use the CLI: `parallel_test spec -t rspec --runtime-log my.log`
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
- ### Test::Unit & Minitest 4/5
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 pasteable command-line snippets for each failed example.
150
+ Produce pastable command-line snippets for each failed example. For example:
145
151
 
146
- E.g.
147
-
148
- rspec /path/to/my_spec.rb:123 # should do something
152
+ ```bash
153
+ rspec /path/to/my_spec.rb:123 # should do something
154
+ ```
149
155
 
150
- Add the following to your `.rspec_parallel` (or `.rspec`) :
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 test/
180
- parallel_rspec spec/
181
- parallel_cucumber features/
182
- parallel_spinach features/
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
- - use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc.
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
- `parallel_test -- -t acceptance -f progress -- spec/foo_spec.rb spec/acceptance`
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
- found - order of finding files
200
- steps - number of cucumber/spinach steps
201
- scenarios - individual cucumber scenarios
202
- filesize - by size of the file
203
- runtime - info from runtime log
204
- default - runtime when runtime log is filled otherwise filesize
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
- --only-group INT[, INT]
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
- '_spec.rb$' - matches rspec files
214
- '_(test|spec).rb$' - matches test or spec files
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 Allowed percentage of missing runtimes (default = 50)
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
- --verbose Print more output
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] to use spring you have to [patch it](https://github.com/grosser/parallel_tests/wiki/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 parallel test (e.g. Travis Support)](https://github.com/grosser/parallel_tests/wiki/Distributed-Parallel-Tests-and-Travis-Support)
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 gotaches to the [Wiki](https://github.com/grosser/parallel_tests/wiki) or even better open a PR :)
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/>
@@ -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("../..", __FILE__)
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("../..", __FILE__)
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("../..", __FILE__)
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("../..", __FILE__)
5
+ root = File.expand_path('..', __dir__)
5
6
  $LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
6
7
 
7
8
  require "parallel_tests"