Create a class that fails test case
package testNG;
import org.testng.Assert;
import org.testng.annotations.Test;
public class TestFailClass {
@Test(retryAnalyzer=MyRetry.class)
public void failMethod(){
System.out.println("FAILED CLASS");
Assert.assertTrue(false);
}
}
Create a class that re-runs the failed test cases
package testNG;
import java.util.ArrayList;
import java.util.List;
import org.testng.TestNG;
public class RunFailed {
public static void main(String[] args) {
TestNG testRunner = new TestNG();
List<String> failedXmls = new ArrayList<String>();
//Enter the full path for the 'test-faailed.xml' file
failedXmls.add("C:/Users/Mutturaj.h/workspace/hulagabal/test-output/testng-failed.xml");
testRunner.setTestSuites(failedXmls);
testRunner.run();
}
}
No comments:
Post a Comment