TestNG Tutorial #17 – How to Execute Failed Test Cases in Selenium

In this TestNG tutorial we will learn how to execute failed Test Cases in Selenium WebDriver. You can use TestNG retry analyzer to automatically retry a test whenever it fails.

Once you bind a retry analyzer to a test, TestNG automatically invokes the retry analyzer to determine if TestNG can retry a test case again in an attempt to see if the test that just failed now passes.

Following are the steps to use a retry analyzer:

✅ Step 1 – Build an implementation of the interface org.testng.IRetryAnalyzer

✅ Step 2 – Bind this implementation to the @Test annotation, example, @Test(retryAnalyzer = LocalRetry.class)