我尝试用runnable jar文件构建我的selenium项目。
我使用下面的代码: -
SELECT customer,SUM(price)
FROM table
WHERE date BETWEEN 3-Jan-2015 AND 8-Jan-2015
GROUP BY customer
它给我配置失败:1如下: -
public static void main(String[] args) {
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { LoginTest.class });
testng.addListener(tla);
testng.run();
}
上面的代码只运行我的课程。我需要运行testng.xml。我不知道我在这里做错了什么
我也尝试过sh文件
[TestNG] Running:
Command line suite
===============================================
Command line suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 0
===============================================
它在IDE中工作正常,即使它运行我的testng.xml但是在创建运行jar后它没有在终端上显示任何东西
我也试过以下代码: -
public static void main(String[] args) {
ProcessBuilder pb = new ProcessBuilder("./shtry.sh", "myArg1", "myArg2");
try {
Process p = pb.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null)
{
System.out.println(line);
}
} catch (Exception e) {
e.getMessage();
}
}
它在IDE中工作正常,即使它运行我的testng.xml但是没有任何工作