Executing Failed TestCases in Selenium using TestNG – User friendly Tech help
nWe want to re-run only the failed testcases in selenium, rather than running the entire suite.
nEvery time tests fail in a suite, TestNG creates a file called testng-failed.xml in the output directory. This XML file contains the necessary information to rerun only these methods that failed, utlizing this we can easily rerun the failed tests without having to run the entire test suite.
nNote:- For running the test exactly after the failure we need to call the method that failed. We can get that method name from IRetryAnalyzer interface . If we just want to rerun all the failed test cases together, then we can give the testng-failed.xml as input xml after the first execution.But remember this will result in creation of 2 reports, one of previous run + latest run of the failed test cases, rather than having the consolidated report
nLocate the testng-failed.xml file
nRerun this file to execute only the failed test cases.
n(Open file -> CTRL+F11)
|testng-failed.xml file view|
How to run parallel Selenium Tests