Skip to content

Instantly share code, notes, and snippets.

@ciembor
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciembor/b386de62e29a99b4ed1e to your computer and use it in GitHub Desktop.
Save ciembor/b386de62e29a99b4ed1e to your computer and use it in GitHub Desktop.
namespace :failing_cucumber_specs do
FAILING_SCENARIOS_FILENAME = 'failing_scenarios.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
exec("bundle exec cucumber @#{FAILING_SCENARIOS_FILENAME}")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment