parallel_tests 0.14.0 → 0.15.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel_tests (0.14.0)
4
+ parallel_tests (0.15.0)
5
5
  parallel
6
6
 
7
7
  GEM
data/Readme.md CHANGED
@@ -289,6 +289,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
289
289
  - [Alejandro Pulver](https://github.com/alepulver)
290
290
  - [Felix Clack](https://github.com/felixclack)
291
291
  - [Izaak Alpert](https://github.com/karlhungus)
292
+ - [Micah Geisel](https://github.com/botandrose)
292
293
 
293
294
  [Michael Grosser](http://grosser.it)<br/>
294
295
  michael@grosser.it<br/>
@@ -7,6 +7,30 @@ module ParallelTests
7
7
  def name
8
8
  'cucumber'
9
9
  end
10
+
11
+ def line_is_result?(line)
12
+ super or line =~ failing_scenario_regex
13
+ end
14
+
15
+ def summarize_results(results)
16
+ output = []
17
+
18
+ failing_scenarios = results.grep(failing_scenario_regex)
19
+ if failing_scenarios.any?
20
+ failing_scenarios.unshift("Failing Scenarios:")
21
+ output << failing_scenarios.join("\n")
22
+ end
23
+
24
+ output << super
25
+
26
+ output.join("\n\n")
27
+ end
28
+
29
+ private
30
+
31
+ def failing_scenario_regex
32
+ /^cucumber features\/.+:\d+/
33
+ end
10
34
  end
11
35
  end
12
36
  end
@@ -31,6 +31,7 @@ module ParallelTests
31
31
  end
32
32
 
33
33
  def line_is_result?(line)
34
+ line.gsub!(/[.F*]/,'')
34
35
  line =~ /\d+ failure/
35
36
  end
36
37
 
@@ -72,7 +73,7 @@ module ParallelTests
72
73
 
73
74
  def find_results(test_output)
74
75
  test_output.split("\n").map {|line|
75
- line = line.gsub(/\.|F|\*/,'').gsub(/\e\[\d+m/,'')
76
+ line.gsub!(/\e\[\d+m/,'')
76
77
  next unless line_is_result?(line)
77
78
  line
78
79
  }.compact
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '0.14.0'
2
+ VERSION = Version = '0.15.0'
3
3
  end
@@ -236,6 +236,8 @@ describe 'CLI' do
236
236
  write "features/steps/a.rb", "
237
237
  Given('I print TEST_ENV_NUMBER'){ puts \"YOUR TEST ENV IS \#{ENV['TEST_ENV_NUMBER']}!\" }
238
238
  And('I sleep a bit'){ sleep 0.2 }
239
+ And('I pass'){ true }
240
+ And('I fail'){ fail }
239
241
  "
240
242
  end
241
243
 
@@ -286,6 +288,22 @@ describe 'CLI' do
286
288
  results.should include("2 processes for 0 features")
287
289
  results.should include("Took")
288
290
  end
291
+
292
+ it "collates failing scenarios" do
293
+ write "features/pass.feature", "Feature: xxx\n Scenario: xxx\n Given I pass"
294
+ write "features/fail1.feature", "Feature: xxx\n Scenario: xxx\n Given I fail"
295
+ write "features/fail2.feature", "Feature: xxx\n Scenario: xxx\n Given I fail"
296
+ results = run_tests "features", :processes => 3, :type => "cucumber", :fail => true
297
+
298
+ results.should include """
299
+ Failing Scenarios:
300
+ cucumber features/fail2.feature:2 # Scenario: xxx
301
+ cucumber features/fail1.feature:2 # Scenario: xxx
302
+
303
+ 3 scenarios (2 failed, 1 passed)
304
+ 3 steps (2 failed, 1 passed)
305
+ """
306
+ end
289
307
  end
290
308
 
291
309
  context "Spinach", :fails_on_ruby_187 => true do
@@ -8,5 +8,18 @@ describe ParallelTests::Cucumber::Runner do
8
8
  it_should_behave_like 'gherkin runners' do
9
9
  let(:runner_name) {'cucumber'}
10
10
  let(:runner_class){ParallelTests::Cucumber::Runner}
11
+
12
+ describe :summarize_results do
13
+ def call(*args)
14
+ runner_class().summarize_results(*args)
15
+ end
16
+
17
+ it "collates failing scenarios" do
18
+ results = ["Failing Scenarios:", "cucumber features/failure:1", "cucumber features/failure:2",
19
+ "Failing Scenarios:", "cucumber features/failure:3", "cucumber features/failure:4",
20
+ "Failing Scenarios:", "cucumber features/failure:5", "cucumber features/failure:6"]
21
+ call(results).should == "Failing Scenarios:\ncucumber features/failure:1\ncucumber features/failure:2\ncucumber features/failure:3\ncucumber features/failure:4\ncucumber features/failure:5\ncucumber features/failure:6\n\n"
22
+ end
23
+ end
11
24
  end
12
25
  end
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.14.0
4
+ version: 0.15.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -1541813379491752790
105
+ hash: 2228048421708022476
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: -1541813379491752790
114
+ hash: 2228048421708022476
115
115
  requirements: []
116
116
  rubyforge_project:
117
117
  rubygems_version: 1.8.25