How to rerun Cucumber failed scenarios?

In this blog article, we will walk you through how to rerun jvm-Cucumber failed scenarios.

Step #1 Configure where you want to store failed scenario details in Runner class
Note: Use rerun variable in CucumberOptions to store the failed scenarios.
Step #2 Create a new Runner class to run the failed scenarios.
Note: In the ‘features’ variable, you need mention the failed_scenarios.txt file and don’t forget that you must mention ‘@’ symbol before the file path.
If you are running your automated test scripts from Jenkins, you can create and configure a downstream job to run the failed scenarios.

2 thoughts on “How to rerun Cucumber failed scenarios?

  1. Hi, this solution is working for TestNG application or only work with Junit Runner? In my case I’m working with TestNG and I’m make the same as you but the failed scenarios are not running. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *