Permalink
Browse files

Introduce parallel tests.

This also removes the rake tasks and formatter stuff that aren't needed
as much any more.
  • Loading branch information...
1 parent febf0ff commit addb9fbe68ad5b0558734f608a7af5869c304414 @steveklabnik steveklabnik committed May 2, 2014
Showing with 8 additions and 97 deletions.
  1. +1 −1 .travis.yml
  2. +2 −0 Gemfile
  3. +4 −0 Gemfile.lock
  4. +1 −36 Rakefile
  5. +0 −60 formatters/in_progress.rb
View
@@ -1,4 +1,4 @@
language: ruby
rvm:
- 2.0.0
-script: bin/rake cruise
+script: bin/rake cucumber
View
@@ -5,3 +5,5 @@ gem "httparty"
gem "json-schema"
gem "uri_template"
gem "rake"
+
+gem "parallel_tests"
View
@@ -19,6 +19,9 @@ GEM
multi_json (1.8.2)
multi_test (0.0.2)
multi_xml (0.5.5)
+ parallel (1.0.0)
+ parallel_tests (0.16.10)
+ parallel
rake (10.1.0)
uri_template (0.6.0)
@@ -29,5 +32,6 @@ DEPENDENCIES
cucumber
httparty
json-schema
+ parallel_tests
rake
uri_template
View
@@ -1,11 +1,5 @@
require 'cucumber/rake/task'
-
-class BuildFailure < Exception;
- def initialize(message = nil)
- message ||= "Build failed"
- super(message)
- end
-end;
+require 'parallel_tests/tasks'
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = "--format progress --tags ~@failing"
@@ -20,33 +14,4 @@ namespace :features do
Cucumber::Rake::Task.new(:all) do |t|
t.cucumber_opts = "--format progress"
end
-
- desc "Run in-progress features"
- Cucumber::Rake::Task.new(:in_progress) do |t|
- t.cucumber_opts = "--require formatters/ --format Cucumber::Formatter::InProgress --tags @failing"
- end
-end
-
-desc "Run complete feature build"
-task :cruise do
- finished_successful = run_and_check_for_exception("cucumber")
- in_progress_successful = run_and_check_for_exception("features:in_progress")
-
- unless finished_successful && in_progress_successful
- puts
- puts("Finished features had failing steps") unless finished_successful
- puts("In-progress Scenario/s passed when they should fail or be pending") unless in_progress_successful
- puts
- raise BuildFailure
- end
-end
-
-def run_and_check_for_exception(task_name)
- puts "*** Running #{task_name} features ***"
- begin
- Rake::Task["#{task_name}"].invoke
- rescue Exception => e
- return false
- end
- true
end
View
@@ -1,60 +0,0 @@
-require 'cucumber/formatter/progress'
-
-module Cucumber
- module Formatter
- class InProgress < Progress
- FAILURE_CODE = 1
- SUCCESS_CODE = 0
-
- FORMATS[:invalid_pass] = Proc.new{ |string| ::Term::ANSIColor.blue(string) }
-
- def initialize(step_mother, io, options)
- super(step_mother, io, options)
- @scenario_passed = true
- @passing_scenarios = []
- @feature_element_count = 0
- end
-
- def visit_feature_element(feature_element)
- super
-
- @passing_scenarios << feature_element if @scenario_passed
- @scenario_passed = true
- @feature_element_count += 1
-
- @io.flush
- end
-
- def visit_exception(exception, status)
- @scenario_passed = false
- super
- end
-
- private
-
- def print_summary(features)
- unless @passing_scenarios.empty?
- @io.puts format_string("(::) Scenarios passing which should be failing or pending (::)", :invalid_pass)
- @io.puts
- @passing_scenarios.each do |element|
- @io.puts(format_string(element.backtrace_line, :invalid_pass))
- end
- @io.puts
- end
-
- unless @passing_scenarios.empty?
- override_exit_code(FAILURE_CODE)
- else
- override_exit_code(SUCCESS_CODE)
- end
- end
-
- def override_exit_code(status_code)
- at_exit do
- Kernel.exit(status_code)
- end
- end
-
- end
- end
-end

0 comments on commit addb9fb

Please sign in to comment.