-
-
Save stevenjackson/4225614 to your computer and use it in GitHub Desktop.
Cucumber Rerun Rake Task
This file contains hidden or 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 CucumberFailure.new 'Cucumber tests failed' | |
end | |
end | |
#jruby -S rake regression_with_retry PROFILE=regression_a | |
----------------------------------------- Disclaimer: This message (and any attachments) is confidential and is intended only for the addressee(s). This message may contain information that is protected by one or more legally recognized privileges. If the reader of this message is not the intended recipient, I did not intend to waive, and I do not waive, any legal privilege or the confidentiality of the message. If you receive this message in error, please notify me immediately by return e-mail and delete this message from your computer and network without saving it in any manner. The unauthorized use, dissemination, distribution, or reproduction of this message, including attachments, is prohibited and may be unlawful. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment