Create executable box for selenium code
I need to create an executable Jar file for Selenium Webdriver Project (TestNG) using Eclipse.
After traversing various websites, I realize that we need to create a main class to execute the test suite.
I created a Main class with the code below.
package com.testcases;
import java.util.ArrayList;
import java.util.List;
import org.testng.TestListenerAdapter;
import org.testng.TestNG;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
Class[] classes = new Class[]{
Abc.class,
PQR.class,
XYZ.class
};
testng.setTestClasses(classes);
testng.addListener(tla);
testng.run();
}
}
When I created the runnable Jar using Export-> Java-> Runnable Jar from Selenium and after running the jar file using the command line with the following command:
java -jar AbcXyz.jar
Program execution ends up in an infinite loop
Help build such an executable Jar file.
Below are some links: Testng
+3
source to share