Re-Run failed test cases automatically | restAnalyzer attribute in TestNG | IRestAnalyzer | Selenium

Опубликовано: 10 Октябрь 2024
на канале: Maximum Automation
4,230
36

In this video we are going to see that how to rerun failed test cases in Selenium TestNG.

Whenever a tests fail, then TestNG creates a file called testng-failed.xml in the output directory. This file contains the information of the failed test cases, which allows us to quickly rerun the failed cases only without having to run the entire test suite again.

You can rerun the failed scenarios quickly by doing right click on this xml file and then select as tesng suite to run.

To retry failed test cases the moment they get fail. You can add below class in your framework.

public class RetryTest implements IRetryAnalyzer{

private int retrycount = 0;
private static final int maxcount = 2;

public boolean retry(ITestResult result) {
if(retrycount less than maxcount)
{
retrycount++;
return true;
}
return false;
}

after that you can below attribute to each test method.

@Test(restAnalyzer = RetryTest .classs)
public void testmethod()
{}

*********Please comment in case of any query************


Also please watch other videos as well.

Add Java properties configuration file in framework - Selenium Java -    • Configuration file in automation fram...  

How to setup selenium grid in docker :    • How to setup Selenium Grid in Docker ...  

Log4J2 - Logging in Java Framework :    • Video  

Selenium with Java - Create Junit Cucumber Project :    • Video  

Selenium - Debug/Run Script on Existing Browser :    • Selenium | Debug/Run Script on Existi...  

Selenium with Java - Extent Report - Part1 :    • Selenium with Java | Extent Report 5 ...  

Selenium - WebDriver Manager :    • Selenium | WebDriver Manager | Stop d...  

Parallel Execution - Cucumber - Junit :    • Parallel Execution | Cucumber | Junit  

Selenium with Java - Cucumber Html Report :    • Selenium with Java | Cucumber Html Re...  

Selenium with Java - Integrate TestNG with Cucumber -    • Video  

Selenium with C# - Klov Report :    • Selenium with C# | Klov Report Server  

Selenium with C# - Extent Report :    • Selenium with C# | Extent Report  

Selenium with C# - Create Project to automate test (Selenium + Specflow ) :    • Video  

Selenium with C# - Parallel Execution and Screenshot :    • Video  

Selenium with C# - All about feature files :    • Video  

Selenium with C# - Specflow - External Bindings :    • Selenium C# | Specflow | External Bin...  

Selenium with C# Working with Excel - Part 1 :    • Video  

Selenium C# - Visual Studio Code :    • Selenium C# | Visual Studio Code | No...  
n

How to execute cucumber feature file in Parallel using TestNG | Selenium Java | TestNG -    • How to execute cucumber feature file ...