how to call testng.xml from java main method?
selenium-webdriver
Solution
You can run testng directly from commandline, probably make a bat file on top of it or use jenkins to trigger it. Refer here
or
If you want it in main, then you can try
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
List<String> suites = Lists.newArrayList();
suites.add("c:/tests/testng1.xml");//path to xml..
suites.add("c:/tests/testng2.xml");
testng.setTestSuites(suites);
testng.run();
Problem
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 ( String [ ] args) { Run(testng.xml); } } ```