Wednesday, March 2, 2016

Selenium :Run Testng.xml using a Java file

Run Testng.xml using a Java file

http://stackoverflow.com/questions/23272861/how-to-call-testng-xml-from-java-main-method




// Create object of TestNG Class
TestNG runner=new TestNG();

// Create a list of String 
List<String> suitefiles=new ArrayList<String>();

// Add xml file which you have to execute
suitefiles.add("C:\\Automation Test\\Git\\vne_automation\\testng.xml");

// now set xml file for execution
runner.setTestSuites(suitefiles);

// finally execute the runner using run method
runner.run();

No comments:

Post a Comment