[英]Create Executable Jar for Selenium Code
I need to create a Executable Jar file for the Selenium Webdriver Project (TestNG) using Eclipse. 我需要使用Eclipse为Selenium Webdriver Project(TestNG)创建一个可执行Jar文件。
After crawling various website I understand we need to create a Main Class to execute the Test Suite. 在抓取各种网站后,我了解到我们需要创建一个Main Class来执行Test Suite。
I have created a Main Class with below code. 我用下面的代码创建了一个Main Class。
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 have created a runnable Jar using Export->Java->Runnable Jar from Selenium, and after running through jar file using command prompt with below command: 什么时候,我使用来自Selenium的Export-> Java-> Runnable Jar创建了一个可运行的Jar,并在使用以下命令的命令提示符运行jar文件之后:
java -jar AbcXyz.jar
Program Execution get into the Infinite loop 程序执行进入无限循环
Please help for creating such Executable Jar file. 请帮助创建这样的可执行Jar文件。
Below are some References: Testng 以下是一些参考文献:Testng
Did you end your tests with 你结束了考试吗?
driver.quit();
This could be the reason 这可能是原因
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.