Retry
Retry ~30 mins

Retry Failed Tests

	package week6.day2;

import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;

public class RetryFailedTests implements IRetryAnalyzer{

int maxRetry = 3;
int retryCount = 0;

public boolean retry(ITestResult result) {

if(!result.isSuccess() && retryCount < maxRetry) {
retryCount++;
return true;
}

return false;
}



}
	package week6.day2;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

import org.testng.IAnnotationTransformer;
import org.testng.annotations.ITestAnnotation;

public class RetryListener implements IAnnotationTransformer {

public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {


annotation.setRetryAnalyzer(RetryFailedTests.class);

}

}