parallel_tests 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +4 -4
- data/lib/parallel_tests/cli.rb +1 -1
- data/lib/parallel_tests/cucumber/scenario_line_logger.rb +1 -1
- data/lib/parallel_tests/cucumber/scenarios.rb +1 -1
- data/lib/parallel_tests/gherkin/listener.rb +1 -1
- data/lib/parallel_tests/grouper.rb +15 -7
- data/lib/parallel_tests/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce6ccd3931181ca1ec88b0a66c89423be032e64
|
4
|
+
data.tar.gz: 4b2de8a2931ed83c775fdaa60d486407a4e518ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 524d9dbcb29345dfbfea0ba8e423c9766c2db6e87cbc1cfecbfecd65671ec971a5c390a06d7dbd40e45b37f2d920aeba1ddf178054c755bfd8e8a0300943d5d9
|
7
|
+
data.tar.gz: 09ee314cdf3e62a05b846e77f1f92817af1571e1f1d735b63788146719bf2d0bdfdce9404c5aad9563ff4066e61fd47079a30a30579aaa8d8a57ca13d1aa4dbd
|
data/Readme.md
CHANGED
@@ -11,10 +11,10 @@ Setup for Rails
|
|
11
11
|
[RailsCasts episode #413 Fast Tests](http://railscasts.com/episodes/413-fast-tests)
|
12
12
|
|
13
13
|
### Install
|
14
|
+
`Gemfile`:
|
14
15
|
|
15
16
|
```ruby
|
16
|
-
|
17
|
-
gem "parallel_tests", group: :development
|
17
|
+
gem 'parallel_tests', group: [:development, :test]
|
18
18
|
```
|
19
19
|
|
20
20
|
### Add to `config/database.yml`
|
@@ -80,7 +80,7 @@ Running things once
|
|
80
80
|
===================
|
81
81
|
|
82
82
|
```Ruby
|
83
|
-
#
|
83
|
+
# affected by race-condition: first process may boot slower the second
|
84
84
|
# either sleep a bit or use a lock for example File.lock
|
85
85
|
ParallelTests.first_process? ? do_something : sleep(1)
|
86
86
|
|
@@ -185,7 +185,7 @@ Options are:
|
|
185
185
|
<!-- copy output from bundle exec ./bin/parallel_test -h -->
|
186
186
|
|
187
187
|
-n [PROCESSES] How many processes to use, default: available CPUs
|
188
|
-
-p, --pattern [PATTERN] run tests matching this pattern
|
188
|
+
-p, --pattern [PATTERN] run tests matching this regex pattern
|
189
189
|
--group-by [TYPE] group tests by:
|
190
190
|
found - order of finding files
|
191
191
|
steps - number of cucumber/spinach steps
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -139,7 +139,7 @@ module ParallelTests
|
|
139
139
|
Options are:
|
140
140
|
BANNER
|
141
141
|
opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
|
142
|
-
opts.on("-p", "--pattern [PATTERN]", "run tests matching this pattern") { |pattern| options[:pattern] = /#{pattern}/ }
|
142
|
+
opts.on("-p", "--pattern [PATTERN]", "run tests matching this regex pattern") { |pattern| options[:pattern] = /#{pattern}/ }
|
143
143
|
opts.on("--group-by [TYPE]", <<-TEXT.gsub(/^ /, '')
|
144
144
|
group tests by:
|
145
145
|
found - order of finding files
|
@@ -42,14 +42,22 @@ module ParallelTests
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def build_features_with_steps(tests, options)
|
45
|
-
require '
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
tests.
|
50
|
-
parser.parse(File.read(file)
|
45
|
+
require 'gherkin/parser'
|
46
|
+
ignore_tag_pattern = options[:ignore_tag_pattern].nil? ? nil : Regexp.compile(options[:ignore_tag_pattern])
|
47
|
+
parser = ::Gherkin::Parser.new
|
48
|
+
# format of hash will be FILENAME => NUM_STEPS
|
49
|
+
steps_per_file = tests.each_with_object({}) do |file,steps|
|
50
|
+
feature = parser.parse(File.read(file)).fetch(:feature)
|
51
|
+
|
52
|
+
# skip feature if it matches tag regex
|
53
|
+
next if feature[:tags].grep(ignore_tag_pattern).any?
|
54
|
+
|
55
|
+
# count the number of steps in the file
|
56
|
+
# will only include a feature if the regex does not match
|
57
|
+
all_steps = feature[:children].map{|a| a[:steps].count if a[:tags].grep(ignore_tag_pattern).empty? }.compact
|
58
|
+
steps[file] = all_steps.inject(0,:+)
|
51
59
|
end
|
52
|
-
|
60
|
+
steps_per_file.sort_by { |_, value| -value }
|
53
61
|
end
|
54
62
|
|
55
63
|
def group_by_scenarios(tests, options={})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|