How to create a executable jar file for Testng and the runnnig point should be the Xml file

Here is the better way to do it. But thanks anyways sanbhat.

You can just create a main method which will have list of all test classes to be executed as follows:

public static void main(String[] args) {
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { test_start.class });
testng.addListener(tla);
testng.run();
}

Here is the reference URL from the official testng website.

http://testng.org/doc/documentation-main.html#running-testng-programmatically

Cheers!

Leave a Comment