Created
April 30, 2015 18:59
-
-
Save ciembor/7795ebe80f857a24193c to your computer and use it in GitHub Desktop.
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
namespace :failing_cucumber_specs do | |
# we have multiple nodes, so we need different file for each node | |
FAILING_SCENARIOS_FILENAME = "failing_scenarios_#{ENV['CIRCLE_NODE_INDEX']}.txt" | |
task :record do | |
# run cucumber and record failing scenarios to the file | |
begin | |
Rake::Task['knapsack:cucumber'].invoke("-f rerun --out #{FAILING_SCENARIOS_FILENAME}") | |
rescue SystemExit => e | |
# exit 0, we don't want failed build because of this task | |
puts "#{e.class}: #{e.message}" | |
exit(0) | |
end | |
end | |
task :rerun do | |
# we don't need to run cucumber again if all scenarios passed | |
unless File.zero?("#{FAILING_SCENARIOS_FILENAME}") | |
# run cucumber with failing scenarios only | |
cmd = "bundle exec cucumber @#{FAILING_SCENARIOS_FILENAME}" | |
exec(cmd) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment