Cucumber Re-Run Failed Scenarios Automatically with a Tag

How to rerun the failed scenarios using Cucumber?

Run Cucumber with rerun formatter:

cucumber -f rerun --out rerun.txt

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

Then you can rerun them by using

cucumber @rerun.txt

cucumber re-run failed scenarios automatically with a tag?

I've been considering writing something like what you're describing, but I found this:

http://web.archive.org/web/20160713013212/http://blog.crowdint.com/2011/08/22/auto-retry-failed-cucumber-tests.html

If you're tired of having to re-kick builds in your CI server because of non deterministic failures, this post is for you.

In a nutshell: he makes a new rake task called cucumber:rerun that uses rerun.txt to retry failed tests. It should be pretty easy to add some looping in there to retry at most 3x (for example).

Rerun Failed test Cases in Cucumber Automatically using Maven Command

maven-surefire-plugin has built-in option to rerun failed tests.

Simply add <rerunFailingTestsCount>1</rerunFailingTestsCount> in <configuration> of surefire plugin



Related Topics



Leave a reply



Submit