Open qaEng1213 opened 5 years ago
Can someone please answer this above question ? Even I need answer for this.
@wakaleo any suggestions here ? Sometimes we have tests which rely on third party stuff and are unstable so having a mechanism for retrying failed tests would be great. Your answer would be helpful for other people, too.
Hi! I am interested in this too.
When we have very large cucumber tests and they run over long period of time , some of them fail due to timeout. But when we re run as single test they pass. Clients often ask for reason for failing tests and sometime we do not able to provide correct failing test.
We need the retry failing tests feature.
You can use the standard Cucumber retry feature for this
Hi! Could you please explain how must be configured standard Cucumber retry?
Thanks!
Hi! Could you please explain how must be configured standard Cucumber retry?
Thanks!
I use serenity cucumber with fail safe plugin there is a property for retry failed tests which is working fine in my case.
-Dfailsafe.rerunFailingTestsCount={number of retries}
@anoopsivarajan Could you please tell me exact steps to achieve retry functionality in serenity cucumber, like changes in pom.xml and serenity.properties
There are a few approaches here: https://stackoverflow.com/questions/11719898/how-to-rerun-the-failed-scenarios-using-cucumber
@wakaleo above approach is for re-executing the failed test cases after whole test suite execution. Is there any way in serenity to retry failed test case the moment it fails in the test suite.
No
@rdatla-fops You need to use the maven-failsafe-plugin and add the failsafe property like below.
mvn clean verify -Dfailsafe.rerunFailingTestsCount=3.
The above command will run the test as normal, if it fails it will retry tests upto 3 times before failing the test. Read the cucumber section in the failsafe plugin documents.
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/rerun-failing-tests.html
@anoopsivarajan I am using following file safe dependency
The maven-failsafe-plugin retry feature will work (to some extent) if you have separate test runners for each of your feature files.
@rdatla-fops You can find a sample Serenity starter screenplay cucumber project in this link(replace the driver with your version).
https://github.com/anoopsivarajan/Serenity-Retry-Test
If your run the test with mvn clean verify you will see the test failing and finishing the build.
Try with the command below and you will find that the test executes 4 times in total before failing the build.
mvn clean verify -Dfailsafe.rerunFailingTestsCount=3
I can confirm that -Dfailsafe.rerunFailingTestsCount=3 worked perfectly thanks for the info
Hi! Could you please explain how must be configured standard Cucumber retry? Thanks!
I use serenity cucumber with fail safe plugin there is a property for retry failed tests which is working fine in my case.
-Dfailsafe.rerunFailingTestsCount={number of retries}
This worked for me.
@anoopsivarajan I'm actually using the following command with maven "mvn verify -Dfailsafe.rerunFailingTestsCount=2", and it works properly, but I still have the issue with gradle, do you know how to solve it?, I checked your framework and it did not run with gradle
Is there any opportunity to setup Serenity/Cucumber to rerun failed tests ? What I've tried so far is putting into serenity.properties this params:
test.retry.count=3 max.retries=4 junit.retry.tests=true test.retry.count.cucumber=3
None of them worked. Any ideas?