How to Re-run Failed Scenarios in Cucumber



Usually we require to rerun the failed test cases again once they are fixed or for double verification.In cucumber we can do that easily without developing any customize code for it.


Cucumber directly supports the feature to re- run the failed test cases as following:

Run Cucumber with rerun formatter simply using :

  cucumber -f rerun --out rerun.txt

It will output locations of all failed scenarios to the file.

Then you can rerun them by using

cucumber @rerun.txt

This can be further bundled as a rake task and can be run simply as :

require 'cucumber'
require 'cucumber/rake/task'

Cucumber::Rake::Task.new(:jenkins_with_rerun) do |t|
  cucumber -f rerun --out rerun.txt

  cucumber @rerun.txt
end

task :default => :jenkins_with_rerun
 And then can be run as simply "rake" inside the project folder:
 C:/>ProjectFolder>rake




Comments

Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication