Quality Testing

Quality is delighting customers

How to re-run failed test cases in selenium webDriver ?


I am new to this site. I am posting my first query.

How to re-run failed test cases in Selenium WebDriver?

Views: 374

Reply to This

Replies to This Discussion

Check this link for both explanation and sample script to run the failing tests in selenium/TestNG

Thanks for your reply.

If you want to rerun failed scripts. Just add failed scripts in suite and run again.

Using TestNG framework and little changes to the XML file we can rerun all failed scripts without much effort.

We can use TestNG class and specify the failed_test.xml path to the TestNG to run the failed test cases. For more details, View below link:


Just select the select the recorrected and recompiled failed test script from the project explorer of the eclipse IDE and right click the Mose button,select run as Testng option from various options shown after right clicking the mouse.
You should able to Rerun/Reexecute the Failed Test Script and after the run/execution completion the you have to select the relevant Testing Report XML file which will available in the project explore section, select the Testing Report File and open the file, it will show the Test Summary Report with the details of Pass/Failed results of all your test cases run under the Test Suite selected for the run, you can verify the results of the failed test cases too, the above scenario works when the entire Test suite is selected for the rerun/rexecution which includes the rerun of the failed Test cases also.

However there is one another option wherein you can select the specific recreated and recompiled failed test case/test cases from the project explorer of the Eclipse IDE and right click the mouse you can select run as TestNg option and as usual after the rerun/reexecution of the selected test cases you, as usual as I mentioned previously you will be provided with Test Summary Report in XML under the project Explore option and open the XML Report, now you can only the details of Pass/Failed results of the selected rerun/ rexecuted test cases only.
Note: Anytimes Even when you are Rerunning/ Reexecuting your corrected Failed Test Cases, it is mandatory that test cases are compiled every time when changes are made and there should not be any compilation errors without which the execution/rerun will not happen for the corrected test cases and if there exists a fault in your corrected test script,it will only show compilation errors and it will not rexecuted/ rerun by the TestNg with no results available in the TestNg Summary XML Report.

Hope I was able to give you an answer and let me know your inputs after using the above approach given by me to address your query.


TTWT Magazine





© 2017   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service