How to Rerun Failed test cases TestNG By Programmatically Program?

How to Rerun Failed test cases TestNG By Programmatically Program?

package com.selenium.TestNG;
import java.util.ArrayList;
import java.util.List;
import org.testng.TestNG;
public class RerunFailedtestcases 
{
   public static void main(String[] args) 
   {
      TestNG runner=new TestNG();
      List <String> list=new ArrayList<String>();
      list.add("G:\\Git_Base_Folder\\softwaretestingblog\\Daily_Practice\\test-output\\testng-failed.xml");
      runner.setTestSuites(list);
      runner.run();
   }
}

Avatar for Softwaretestingo Editorial Board

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

Leave a Comment