How to handle failures in Test Suite in selenium webdriver

1k views Asked by At

Suppose I have 10 test cases in my Test suite and when I execute the Test suite I get an error for test case no.7.

Now is there any way that I can restart my execution from test case no.7 after correcting the changes?

I'm using TestNG.

Do we have recovery scenarios in Selenium?

2

There are 2 answers

0
Jaroslav Cincera On BEST ANSWER

TestNG generates .xml configuration with failed tests http://testng.org/doc/documentation-main.html#rerunning

Or you can use org.testng.IRetryAnalyzer which runs failed tests again and you have more control over it.

Example here http://seleniumeasy.com/testng-tutorials/execute-only-failed-test-cases-using-iretryanalyzer.

0
Priyanshu On

Yes you can do that if you are using Eclipse IDE. Click on the arrow just before test class name, it will show you all the methods(test cases) of that test class. Right click on the one which you want to run. It will run that specific test only.