I have testng.xml file created. Is there any way to run this file from java main method?
Something like -
Class test {
public static void main ( St
This work for me. More details here.
// Create object of TestNG Class
TestNG runner=new TestNG();
// Create a list of String
List suitefiles=new ArrayList();
// 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();
Hope this helps!