0

Is there any way to re run the failed testcase from the page where it got failed instead of running the testcase from beginning in Selenium Java ?

1

No, not by default. It could be possible, but you need to store which code can be skipped and somehow put this logic in your tests. This would create a pretty complex test-framework.

Make your tests shorter :) WebDriver tests should run in seconds, not minutes.

0

As per the TestNG documentation for rerunning, Every 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, allowing you to quickly reproduce the failures without having to run the entirety of your tests. So, you just need to do like this

java -classpath testng.jar;%CLASSPATH% org.testng.TestNG -d test-outputs test-outputs\testng-failed.xml

This is the manual approach, for the automatic way you need to implement a login for Retry Test using TestNG Listener IRetryAnalyzer to handle max-retry count and all. There are many similar threads that have been discussed on same topic.

Restart failed test case automatically in TestNG/Selenium, Rerun a test class when it fails

Hope this helps!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.