parallel_tests 1.0.9 → 1.1.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.md +7 -3
  3. data/bin/parallel_cucumber +5 -1
  4. data/bin/parallel_rspec +5 -1
  5. data/bin/parallel_spinach +5 -1
  6. data/bin/parallel_test +5 -2
  7. data/lib/parallel_tests.rb +0 -1
  8. metadata +3 -51
  9. data/.gitignore +0 -4
  10. data/.rspec +0 -2
  11. data/.travis.yml +0 -10
  12. data/Gemfile +0 -9
  13. data/Gemfile.lock +0 -53
  14. data/Rakefile +0 -10
  15. data/ReadmeRails2.md +0 -48
  16. data/lib/parallel_tests/cli.rb +0 -206
  17. data/lib/parallel_tests/cucumber/failures_logger.rb +0 -25
  18. data/lib/parallel_tests/cucumber/runner.rb +0 -37
  19. data/lib/parallel_tests/cucumber/scenario_line_logger.rb +0 -51
  20. data/lib/parallel_tests/cucumber/scenarios.rb +0 -34
  21. data/lib/parallel_tests/gherkin/io.rb +0 -41
  22. data/lib/parallel_tests/gherkin/listener.rb +0 -87
  23. data/lib/parallel_tests/gherkin/runner.rb +0 -116
  24. data/lib/parallel_tests/gherkin/runtime_logger.rb +0 -28
  25. data/lib/parallel_tests/grouper.rb +0 -73
  26. data/lib/parallel_tests/railtie.rb +0 -8
  27. data/lib/parallel_tests/rspec/failures_logger.rb +0 -54
  28. data/lib/parallel_tests/rspec/logger_base.rb +0 -55
  29. data/lib/parallel_tests/rspec/runner.rb +0 -73
  30. data/lib/parallel_tests/rspec/runtime_logger.rb +0 -59
  31. data/lib/parallel_tests/rspec/summary_logger.rb +0 -19
  32. data/lib/parallel_tests/spinach/runner.rb +0 -19
  33. data/lib/parallel_tests/tasks.rb +0 -157
  34. data/lib/parallel_tests/test/runner.rb +0 -186
  35. data/lib/parallel_tests/test/runtime_logger.rb +0 -98
  36. data/lib/parallel_tests/version.rb +0 -3
  37. data/parallel_tests.gemspec +0 -14
  38. data/spec/integration_spec.rb +0 -437
  39. data/spec/parallel_tests/cli_spec.rb +0 -149
  40. data/spec/parallel_tests/cucumber/failure_logger_spec.rb +0 -43
  41. data/spec/parallel_tests/cucumber/runner_spec.rb +0 -25
  42. data/spec/parallel_tests/cucumber/scenarios_spec.rb +0 -69
  43. data/spec/parallel_tests/gherkin/listener_spec.rb +0 -96
  44. data/spec/parallel_tests/gherkin/runner_behaviour.rb +0 -216
  45. data/spec/parallel_tests/grouper_spec.rb +0 -61
  46. data/spec/parallel_tests/rspec/failures_logger_spec.rb +0 -82
  47. data/spec/parallel_tests/rspec/logger_base_spec.rb +0 -35
  48. data/spec/parallel_tests/rspec/runner_spec.rb +0 -201
  49. data/spec/parallel_tests/rspec/runtime_logger_spec.rb +0 -131
  50. data/spec/parallel_tests/rspec/summary_logger_spec.rb +0 -37
  51. data/spec/parallel_tests/spinach/runner_spec.rb +0 -12
  52. data/spec/parallel_tests/tasks_spec.rb +0 -178
  53. data/spec/parallel_tests/test/runner_spec.rb +0 -407
  54. data/spec/parallel_tests/test/runtime_logger_spec.rb +0 -112
  55. data/spec/parallel_tests_spec.rb +0 -137
  56. data/spec/spec_helper.rb +0 -182
@@ -1,149 +0,0 @@
1
- require "spec_helper"
2
- require "parallel_tests/cli"
3
- require "parallel_tests/rspec/runner"
4
-
5
-
6
- describe ParallelTests::CLI do
7
- subject { ParallelTests::CLI.new }
8
-
9
- describe "#parse_options" do
10
- let(:defaults){ {:files => []} }
11
-
12
- def call(*args)
13
- subject.send(:parse_options!, *args)
14
- end
15
-
16
- it "parses regular count" do
17
- call(["-n3"]).should == defaults.merge(:count => 3)
18
- end
19
-
20
- it "parses count 0 as non-parallel" do
21
- call(["-n0"]).should == defaults.merge(:non_parallel => true)
22
- end
23
-
24
- it "parses non-parallel as non-parallel" do
25
- call(["--non-parallel"]).should == defaults.merge(:non_parallel => true)
26
- end
27
-
28
- it "finds the correct type when multiple are given" do
29
- call(["--type", "test", "-t", "rspec"])
30
- subject.instance_variable_get(:@runner).should == ParallelTests::RSpec::Runner
31
- end
32
-
33
- it "parses nice as nice" do
34
- call(["--nice"]).should == defaults.merge(:nice => true)
35
- end
36
-
37
- context "parse only-group" do
38
- it "group_by should be set to filesize" do
39
- call(["--only-group", '1']).should == defaults.merge(:group_by=>:filesize, :only_group => [1])
40
- end
41
-
42
- it "raise error when group_by isn't filesize" do
43
- expect{
44
- call(["--only-group", '1', '--group-by', 'steps'])
45
- }.to raise_error(RuntimeError)
46
- end
47
-
48
- context "with group_by default to filesize" do
49
- let(:defaults_with_filesize){defaults.merge(:group_by => :filesize)}
50
-
51
- it "with multiple groups" do
52
- call(["--only-group", '4,5']).should == defaults_with_filesize.merge(:only_group => [4,5])
53
- end
54
-
55
- it "with a single group" do
56
- call(["--only-group", '4']).should == defaults_with_filesize.merge(:only_group => [4])
57
- end
58
- end
59
- end
60
- end
61
-
62
- describe "#load_runner" do
63
- it "requires and loads default runner" do
64
- subject.should_receive(:require).with("parallel_tests/test/runner")
65
- subject.send(:load_runner, "test").should == ParallelTests::Test::Runner
66
- end
67
-
68
- it "requires and loads rspec runner" do
69
- subject.should_receive(:require).with("parallel_tests/rspec/runner")
70
- subject.send(:load_runner, "rspec").should == ParallelTests::RSpec::Runner
71
- end
72
-
73
- it "requires and loads runner with underscores" do
74
- subject.should_receive(:require).with("parallel_tests/my_test_runner/runner")
75
- subject.send(:load_runner, "my_test_runner").should == ParallelTests::MyTestRunner::Runner
76
- end
77
-
78
- it "fails to load unfindable runner" do
79
- expect{
80
- subject.send(:load_runner, "foo").should == ParallelTests::RSpec::Runner
81
- }.to raise_error(LoadError)
82
- end
83
- end
84
-
85
- describe "#final_fail_message" do
86
- before do
87
- subject.instance_variable_set(:@runner, ParallelTests::Test::Runner)
88
- end
89
-
90
- it 'returns a plain fail message if colors are nor supported' do
91
- subject.should_receive(:use_colors?).and_return(false)
92
- subject.send(:final_fail_message).should == "Tests Failed"
93
- end
94
-
95
- it 'returns a colorized fail message if colors are supported' do
96
- subject.should_receive(:use_colors?).and_return(true)
97
- subject.send(:final_fail_message).should == "\e[31mTests Failed\e[0m"
98
- end
99
- end
100
-
101
- describe "#run_tests_in_parallel" do
102
- context "specific groups to run" do
103
- let(:results){ {:stdout => "", :exit_status => 0} }
104
- before do
105
- subject.should_receive(:load_runner).with("my_test_runner").and_return(ParallelTests::MyTestRunner::Runner)
106
- ParallelTests::MyTestRunner::Runner.stub(:test_file_name).and_return("test")
107
- ParallelTests::MyTestRunner::Runner.should_receive(:tests_in_groups).and_return([
108
- ['aaa','bbb'],
109
- ['ccc', 'ddd'],
110
- ['eee', 'fff']
111
- ])
112
- subject.should_receive(:report_results).and_return(nil)
113
- end
114
-
115
- it "calls run_tests once when one group specified" do
116
- subject.should_receive(:run_tests).once.and_return(results)
117
- subject.run(['-n', '3', '--only-group', '1', '-t', 'my_test_runner'])
118
- end
119
-
120
- it "calls run_tests twice when two groups are specified" do
121
- subject.should_receive(:run_tests).twice.and_return(results)
122
- subject.run(['-n', '3', '--only-group', '1,2', '-t', 'my_test_runner'])
123
- end
124
-
125
- it "run only one group specified" do
126
- options = {:count=>3, :only_group=>[2], :files=>[], :group_by=>:filesize}
127
- subject.should_receive(:run_tests).once.with(['ccc', 'ddd'], 0, 1, options).and_return(results)
128
- subject.run(['-n', '3', '--only-group', '2', '-t', 'my_test_runner'])
129
- end
130
-
131
- it "run twice with multiple groups" do
132
- options = {:count=>3, :only_group=>[2,3], :files=>[], :group_by=>:filesize}
133
- subject.should_receive(:run_tests).once.ordered.with(['ccc', 'ddd'], 0, 1, options).and_return(results)
134
- subject.should_receive(:run_tests).once.ordered.with(['eee', 'fff'], 1, 1, options).and_return(results)
135
- subject.run(['-n', '3', '--only-group', '2,3', '-t', 'my_test_runner'])
136
- end
137
- end
138
- end
139
- end
140
-
141
-
142
-
143
- module ParallelTests
144
- module MyTestRunner
145
- class Runner
146
- end
147
- end
148
- end
149
-
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
- require 'parallel_tests/gherkin/io'
3
- require 'parallel_tests/cucumber/failures_logger'
4
-
5
- describe ParallelTests::Cucumber::FailuresLogger do
6
-
7
- before do
8
- @output = OutputLogger.new([])
9
- @output.stub(:write)
10
-
11
- @logger1 = ParallelTests::Cucumber::FailuresLogger.new(nil, @output, nil)
12
- @logger2 = ParallelTests::Cucumber::FailuresLogger.new(nil, @output, nil)
13
- @logger3 = ParallelTests::Cucumber::FailuresLogger.new(nil, @output, nil)
14
-
15
- @feature1 = mock('feature', :file => "feature/path/to/feature1.feature")
16
- @feature2 = mock('feature', :file => "feature/path/to/feature2.feature")
17
- @feature3 = mock('feature', :file => "feature/path/to/feature3.feature")
18
-
19
- @logger1.instance_variable_set("@lines", [1, 2, 3])
20
- @logger2.instance_variable_set("@lines", [2, 4, 6])
21
- @logger3.instance_variable_set("@lines", [3, 6, 9])
22
- end
23
-
24
- it "should produce a list of lines for failing scenarios" do
25
- @logger1.after_feature(@feature1)
26
- @logger2.after_feature(@feature2)
27
- @logger3.after_feature(@feature3)
28
-
29
- output_file_contents = @output.output.join("\n").concat("\n")
30
-
31
- output_file_contents.should == <<END
32
- feature/path/to/feature1.feature:1
33
- feature/path/to/feature1.feature:2
34
- feature/path/to/feature1.feature:3
35
- feature/path/to/feature2.feature:2
36
- feature/path/to/feature2.feature:4
37
- feature/path/to/feature2.feature:6
38
- feature/path/to/feature3.feature:3
39
- feature/path/to/feature3.feature:6
40
- feature/path/to/feature3.feature:9
41
- END
42
- end
43
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
- require "parallel_tests/gherkin/runner_behaviour"
3
- require "parallel_tests/cucumber/runner"
4
-
5
- describe ParallelTests::Cucumber::Runner do
6
- test_tests_in_groups(ParallelTests::Cucumber::Runner, 'features', ".feature")
7
-
8
- it_should_behave_like 'gherkin runners' do
9
- let(:runner_name) {'cucumber'}
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
24
- end
25
- end
@@ -1,69 +0,0 @@
1
- require 'tempfile'
2
- require 'parallel_tests/cucumber/scenarios'
3
-
4
- module ParallelTests
5
- module Cucumber
6
- describe Scenarios do
7
- describe '.all' do
8
- context 'by default' do
9
- let(:feature_file) do
10
- Tempfile.new('grouper.feature').tap do |feature|
11
- feature.write <<-EOS
12
- Feature: Grouping by scenario
13
-
14
- Scenario: First
15
- Given I do nothing
16
-
17
- Scenario: Second
18
- Given I don't do anything
19
- EOS
20
- feature.rewind
21
- end
22
- end
23
-
24
- it 'returns all the scenarios' do
25
- scenarios = Scenarios.all([feature_file.path])
26
- scenarios.should eq %W(#{feature_file.path}:3 #{feature_file.path}:6)
27
- end
28
- end
29
-
30
- context 'with tags' do
31
- let(:feature_file) do
32
- Tempfile.new('grouper.feature').tap do |feature|
33
- feature.write <<-EOS
34
- Feature: Grouping by scenario
35
-
36
- @wip
37
- Scenario: First
38
- Given I do nothing
39
-
40
- Scenario: Second
41
- Given I don't do anything
42
-
43
- @ignore
44
- Scenario: Third
45
- Given I am ignored
46
- EOS
47
- feature.rewind
48
- end
49
- end
50
-
51
- it 'ignores those scenarios' do
52
- scenarios = Scenarios.all([feature_file.path], :ignore_tag_pattern => '@ignore, @wip')
53
- scenarios.should eq %W(#{feature_file.path}:7)
54
- end
55
-
56
- it 'return scenarios with tag' do
57
- scenarios = Scenarios.all([feature_file.path], :test_options => '-t @wip')
58
- scenarios.should eq %W(#{feature_file.path}:4)
59
- end
60
-
61
- it 'return scenarios with negative tag' do
62
- scenarios = Scenarios.all([feature_file.path], :test_options => '-t @ignore,~@wip') # @ignore or not @wip
63
- scenarios.should eq %W(#{feature_file.path}:7 #{feature_file.path}:11)
64
- end
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,96 +0,0 @@
1
- require 'parallel_tests/gherkin/listener'
2
-
3
- describe ParallelTests::Gherkin::Listener do
4
- describe :collect do
5
- before(:each) do
6
- @listener = ParallelTests::Gherkin::Listener.new
7
- @listener.uri("feature_file")
8
- end
9
-
10
- it "returns steps count" do
11
- 3.times {@listener.step(nil)}
12
- @listener.collect.should == {"feature_file" => 3}
13
- end
14
-
15
- it "counts background steps separately" do
16
- @listener.background("background")
17
- 5.times {@listener.step(nil)}
18
- @listener.collect.should == {"feature_file" => 0}
19
-
20
- @listener.scenario("scenario")
21
- 2.times {@listener.step(nil)}
22
- @listener.collect.should == {"feature_file" => 2}
23
-
24
- @listener.scenario("scenario")
25
- @listener.collect.should == {"feature_file" => 2}
26
-
27
- @listener.eof
28
- @listener.collect.should == {"feature_file" => 12}
29
- end
30
-
31
- it "counts scenario outlines steps separately" do
32
- @listener.scenario_outline("outline")
33
- 5.times {@listener.step(nil)}
34
- @listener.examples(stub('examples', :rows => Array.new(3)))
35
- @listener.collect.should == {"feature_file" => 15}
36
-
37
- @listener.scenario("scenario")
38
- 2.times {@listener.step(nil)}
39
- @listener.collect.should == {"feature_file" => 17}
40
-
41
- @listener.scenario("scenario")
42
- @listener.collect.should == {"feature_file" => 17}
43
-
44
- @listener.eof
45
- @listener.collect.should == {"feature_file" => 17}
46
- end
47
-
48
- it 'counts scenarios that should not be ignored' do
49
- @listener.ignore_tag_pattern = nil
50
- @listener.scenario( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]) )
51
- @listener.step(nil)
52
- @listener.eof
53
- @listener.collect.should == {"feature_file" => 1}
54
-
55
- @listener.ignore_tag_pattern = /@something_other_than_WIP/
56
- @listener.scenario( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]) )
57
- @listener.step(nil)
58
- @listener.eof
59
- @listener.collect.should == {"feature_file" => 2}
60
- end
61
-
62
- it 'does not count scenarios that should be ignored' do
63
- @listener.ignore_tag_pattern = /@WIP/
64
- @listener.scenario( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]))
65
- @listener.step(nil)
66
- @listener.eof
67
- @listener.collect.should == {"feature_file" => 0}
68
- end
69
-
70
- it 'counts outlines that should not be ignored' do
71
- @listener.ignore_tag_pattern = nil
72
- @listener.scenario_outline( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]) )
73
- @listener.step(nil)
74
- @listener.examples(stub('examples', :rows => Array.new(3)))
75
- @listener.eof
76
- @listener.collect.should == {"feature_file" => 3}
77
-
78
- @listener.ignore_tag_pattern = /@something_other_than_WIP/
79
- @listener.scenario_outline( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]) )
80
- @listener.step(nil)
81
- @listener.examples(stub('examples', :rows => Array.new(3)))
82
- @listener.eof
83
- @listener.collect.should == {"feature_file" => 6}
84
- end
85
-
86
- it 'does not count outlines that should be ignored' do
87
- @listener.ignore_tag_pattern = /@WIP/
88
- @listener.scenario_outline( stub('scenario', :tags =>[ stub('tag', :name => '@WIP' )]) )
89
- @listener.step(nil)
90
- @listener.examples(stub('examples', :rows => Array.new(3)))
91
- @listener.eof
92
- @listener.collect.should == {"feature_file" => 0}
93
- end
94
-
95
- end
96
- end
@@ -1,216 +0,0 @@
1
- require "spec_helper"
2
- require "parallel_tests/gherkin/runner"
3
-
4
- shared_examples_for 'gherkin runners' do
5
- describe :run_tests do
6
- before do
7
- ParallelTests.stub!(:bundler_enabled?).and_return false
8
- File.stub!(:file?).with('.bundle/environment.rb').and_return false
9
- File.stub!(:file?).with("script/#{runner_name}").and_return true
10
- end
11
-
12
- def call(*args)
13
- runner_class().run_tests(*args)
14
- end
15
-
16
- def should_run_with(regex)
17
- ParallelTests::Test::Runner.should_receive(:execute_command).with { |a, b, c, d| a =~ regex }
18
- end
19
-
20
- it "allows to override runner executable via PARALLEL_TESTS_EXECUTABLE" do
21
- ENV['PARALLEL_TESTS_EXECUTABLE'] = 'script/custom_rspec'
22
- should_run_with /script\/custom_rspec/
23
- call(['xxx'], 1, 22, {})
24
- ENV.delete('PARALLEL_TESTS_EXECUTABLE')
25
- end
26
-
27
- it "permits setting env options" do
28
- ParallelTests::Test::Runner.should_receive(:execute_command).with { |a, b, c, options|
29
- options[:env]["TEST"] == "ME"
30
- }
31
- call(['xxx'], 1, 22, {:env => {'TEST' => 'ME'}})
32
- end
33
-
34
- it "runs bundle exec {runner_name} when on bundler 0.9" do
35
- ParallelTests.stub!(:bundler_enabled?).and_return true
36
- should_run_with %r{bundle exec #{runner_name}}
37
- call(['xxx'], 1, 22, {})
38
- end
39
-
40
- it "runs script/{runner_name} when script/{runner_name} is found" do
41
- should_run_with %r{script/#{runner_name}}
42
- call(['xxx'], 1, 22, {})
43
- end
44
-
45
- it "runs {runner_name} by default" do
46
- File.stub!(:file?).with("script/#{runner_name}").and_return false
47
- should_run_with %r{^#{runner_name}}
48
- call(['xxx'], 1, 22, {})
49
- end
50
-
51
- it "uses bin/{runner_name} when present" do
52
- File.stub(:exists?).with("bin/#{runner_name}").and_return true
53
- should_run_with %r{bin/#{runner_name}}
54
- call(['xxx'], 1, 22, {})
55
- end
56
-
57
- it "uses options passed in" do
58
- should_run_with %r{script/#{runner_name} .* -p default}
59
- call(['xxx'], 1, 22, :test_options => '-p default')
60
- end
61
-
62
- it "sanitizes dangerous file runner_names" do
63
- should_run_with %r{xx\\ x}
64
- call(['xx x'], 1, 22, {})
65
- end
66
-
67
- context "with parallel profile in config/{runner_name}.yml" do
68
- before do
69
- file_contents = 'parallel: -f progress'
70
- Dir.stub(:glob).and_return ["config/#{runner_name}.yml"]
71
- File.stub(:read).with("config/#{runner_name}.yml").and_return file_contents
72
- end
73
-
74
- it "uses parallel profile" do
75
- should_run_with %r{script/#{runner_name} .* foo bar --profile parallel xxx}
76
- call(['xxx'], 1, 22, :test_options => 'foo bar')
77
- end
78
-
79
- it "uses given profile via --profile" do
80
- should_run_with %r{script/#{runner_name} .* --profile foo xxx$}
81
- call(['xxx'], 1, 22, :test_options => '--profile foo')
82
- end
83
-
84
- it "uses given profile via -p" do
85
- should_run_with %r{script/#{runner_name} .* -p foo xxx$}
86
- call(['xxx'], 1, 22, :test_options => '-p foo')
87
- end
88
- end
89
-
90
- it "does not use parallel profile if config/{runner_name}.yml does not contain it" do
91
- file_contents = 'blob: -f progress'
92
- should_run_with %r{script/#{runner_name} .* foo bar}
93
- Dir.should_receive(:glob).and_return ["config/#{runner_name}.yml"]
94
- File.should_receive(:read).with("config/#{runner_name}.yml").and_return file_contents
95
- call(['xxx'], 1, 22, :test_options => 'foo bar')
96
- end
97
-
98
- it "does not use the parallel profile if config/{runner_name}.yml does not exist" do
99
- should_run_with %r{script/#{runner_name}} # TODO this test looks useless...
100
- Dir.should_receive(:glob).and_return []
101
- call(['xxx'], 1, 22, {})
102
- end
103
- end
104
-
105
- describe :line_is_result? do
106
- it "should match lines with only one scenario" do
107
- line = "1 scenario (1 failed)"
108
- runner_class().line_is_result?(line).should be_true
109
- end
110
-
111
- it "should match lines with multiple scenarios" do
112
- line = "2 scenarios (1 failed, 1 passed)"
113
- runner_class().line_is_result?(line).should be_true
114
- end
115
-
116
- it "should match lines with only one step" do
117
- line = "1 step (1 failed)"
118
- runner_class().line_is_result?(line).should be_true
119
- end
120
-
121
- it "should match lines with multiple steps" do
122
- line = "5 steps (1 failed, 4 passed)"
123
- runner_class().line_is_result?(line).should be_true
124
- end
125
-
126
- it "should not match other lines" do
127
- line = ' And I should have "2" emails # features/step_definitions/user_steps.rb:25'
128
- runner_class().line_is_result?(line).should be_false
129
- end
130
- end
131
-
132
- describe :find_results do
133
- it "finds multiple results in test output" do
134
- output = <<EOF
135
- And I should not see "/en/" # features/step_definitions/webrat_steps.rb:87
136
-
137
- 7 scenarios (3 failed, 4 passed)
138
- 33 steps (3 failed, 2 skipped, 28 passed)
139
- /apps/rs/features/signup.feature:2
140
- Given I am on "/" # features/step_definitions/common_steps.rb:12
141
- When I click "register" # features/step_definitions/common_steps.rb:6
142
- And I should have "2" emails # features/step_definitions/user_steps.rb:25
143
-
144
- 4 scenarios (4 passed)
145
- 40 steps (40 passed)
146
-
147
- And I should not see "foo" # features/step_definitions/webrat_steps.rb:87
148
-
149
- 1 scenario (1 passed)
150
- 1 step (1 passed)
151
-
152
- EOF
153
- runner_class().find_results(output).should == ["7 scenarios (3 failed, 4 passed)", "33 steps (3 failed, 2 skipped, 28 passed)", "4 scenarios (4 passed)", "40 steps (40 passed)", "1 scenario (1 passed)", "1 step (1 passed)"]
154
- end
155
- end
156
-
157
- describe :summarize_results do
158
- def call(*args)
159
- runner_class().summarize_results(*args)
160
- end
161
-
162
- it "sums up results for scenarios and steps separately from each other" do
163
- results = ["7 scenarios (3 failed, 4 passed)", "33 steps (3 failed, 2 skipped, 28 passed)", "4 scenarios (4 passed)",
164
- "40 steps (40 passed)", "1 scenario (1 passed)", "1 step (1 passed)"]
165
- call(results).should == "12 scenarios (3 failed, 9 passed)\n74 steps (3 failed, 2 skipped, 69 passed)"
166
- end
167
-
168
- it "adds same results with plurals" do
169
- results = ["1 scenario (1 passed)", "2 steps (2 passed)",
170
- "2 scenarios (2 passed)", "7 steps (7 passed)"]
171
- call(results).should == "3 scenarios (3 passed)\n9 steps (9 passed)"
172
- end
173
-
174
- it "adds non-similar results" do
175
- results = ["1 scenario (1 passed)", "1 step (1 passed)",
176
- "2 scenarios (1 failed, 1 pending)", "2 steps (1 failed, 1 pending)"]
177
- call(results).should == "3 scenarios (1 failed, 1 pending, 1 passed)\n3 steps (1 failed, 1 pending, 1 passed)"
178
- end
179
-
180
- it "does not pluralize 1" do
181
- call(["1 scenario (1 passed)", "1 step (1 passed)"]).should == "1 scenario (1 passed)\n1 step (1 passed)"
182
- end
183
- end
184
-
185
- describe 'grouping by scenarios for cucumber' do
186
- def call(*args)
187
- ParallelTests::Gherkin::Runner.send(:run_tests, *args)
188
- end
189
-
190
- it 'groups cucumber invocation by feature files to achieve correct cucumber hook behaviour' do
191
-
192
- test_files = %w(features/a.rb:23 features/a.rb:44 features/b.rb:12)
193
-
194
- ParallelTests::Test::Runner.should_receive(:execute_command).with do |a,b,c,d|
195
- argv = a.split("--").last.split(" ")[2..-1].sort
196
- argv == ["features/a.rb:23:44", "features/b.rb:12"]
197
- end
198
-
199
- call(test_files, 1, 2, { :group_by => :scenarios })
200
- end
201
- end
202
-
203
- describe ".find_tests" do
204
- def call(*args)
205
- ParallelTests::Gherkin::Runner.send(:find_tests, *args)
206
- end
207
-
208
- it "doesn't find bakup files with the same name as test files" do
209
- with_files(['a/x.feature','a/x.feature.bak']) do |root|
210
- call(["#{root}/"]).should == [
211
- "#{root}/a/x.feature",
212
- ]
213
- end
214
- end
215
- end
216
- end