I am currently working on the selenium web driver and testng on Eclipse IDE. I usually run the test from the XML file that i have created which runs all the methods in the eclipse.
Now i want to create a simple executable jar which should do the same i.e its running point should be the XML file so that each test is executed .
I am trying hard on this. Please give me some advice on how to go further with it
Use Eclipse Export Wizard. While exporting, select "Create Runnable Jar" and select the class which is entry point (which contains main method) of your project.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With