We are using Maven for script execution. For reporting we have used TestNG. In case test failed for first time we want to re execute those failed tests again. Is there any option available?
Asked
Active
Viewed 458 times
4
-
1Maven Surefire provide [this](https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#rerunFailingTestsCount) option to re-run failed tests, but only for JUnit apparently – A_Di-Matteo Mar 10 '16 at 09:17
-
After failing test you will get a failed test suite in your report directory, Call again this suite file in your maven again – Sadik Ali Mar 10 '16 at 09:56
-
1This will be of interest http://stackoverflow.com/questions/25781098/is-there-anyway-to-rerun-a-test-class-when-it-fails – Tunaki Mar 10 '16 at 09:57
-
1In case of TestNG when suite execution fails we are deleting all files inside reporting folder. We need to move it to some other folder and again need to pass it as a input to the maven. – amogh Apr 26 '16 at 11:13
1 Answers
1
Implement IRetryAnalyzer
interface to rerun failed test cases with a count to re execute. Add @Test(retryAnalyzer=<classname>)
to test case.

Gerold Broser
- 14,080
- 5
- 48
- 107

Sonali
- 26
- 2