-
-
Save stevenjackson/4225614 to your computer and use it in GitHub Desktop.
Cucumber Rerun Rake Task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cucumber/rake/task' | |
def run_rake_task(name) | |
begin | |
Rake::Task[name].invoke | |
rescue Exception => e | |
return false | |
end | |
true | |
end | |
STDERR.puts ENV['PROFILE'] | |
desc 'Run regression' | |
Cucumber::Rake::Task.new :regression do |t| | |
t.cucumber_opts = ["-p #{ENV['PROFILE']}", "--format rerun --out #{ENV['PROFILE']}_rerun.txt"] | |
end | |
desc 'Rerun failed tests' | |
Cucumber::Rake::Task.new :rerun do |t| | |
t.cucumber_opts = ["-p #{ENV['PROFILE']}", "@#{ENV['PROFILE']}_rerun.txt"] | |
end | |
desc 'Run regression and rerun failed tests' | |
task :regression_with_retry do | |
first_successful = run_rake_task("regression") | |
rerun_successful = true | |
unless first_successful | |
rerun_successful = run_rake_task("rerun") | |
end | |
unless first_successful || rerun_successful | |
raise 'Cucumber tests failed' | |
end | |
end | |
#jruby -S rake regression_with_retry PROFILE=regression_a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment