Quality Testing

Quality is delighting customers

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

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 Testing option from various options shown after right clicking the mouse.

While doing Selenium Training, You should able to Rerun/Re execute 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/reexecution 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.

Views: 131

Reply to This

Replies to This Discussion

In Automation testing, while running the test automation scripts/suites. It happens quite often that few scripts get failed there could be many possible reasons for that like Say Network issues, server issues or developer made changes to the code, any regression Yes issue.

So we might need to re-run them to verify that if there were some temporary issues for failed scripts. So most of the software testing solutions use the TestNG as a testing framework, which already comes with the IRetryAnalyzer interfaceimplementing this we can achieve the re-execution functionality to our test framework. 

Below is the Java file attached for the coda containing the implementation of the IRetryAnalyzer interface.


Alternatively, you can also, use the testng-failed.xml file generated under the 'test-output' folder. 

Simply refresh the project and run the testng-failed.xml file to re-execute the failed test cases.

If you are having any doubts please do let know.


TTWT Magazine





© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service