如何从命令行运行TestNG套件 [英] How to run TestNG suite from command line
问题描述
我想从 Linux
上的命令行运行 TestNG Suite
。我正在使用 eclipse
进行测试,但是命令行有问题。我知道我需要拥有 testng.jar
,并且它位于 /home/karcio/dev/testng-6.4.jar $ c中$ c>,我的套件xml的位置是
/ home / karcio / git / java-test-automation / Automation / test-output / Default suite / TestSuite.xml
。命令我尝试过的命令
I would like to run TestNG Suite
from command line on Linux
. I'm using eclipse
to run test, but I have problem with command line. I know that I need to have testng.jar
and I have it in /home/karcio/dev/testng-6.4.jar
, location my suite xml is /home/karcio/git/java-test-automation/Automation/test-output/Default suite/TestSuite.xml
. Commands what I tried,
- 设置类路径
/home/karcio/dev/testng-6.4.jar
- cd /我的套件xml文件的位置:
java org.testing.TestNG TestSuite.xml
- set classpath
/home/karcio/dev/testng-6.4.jar
- cd /location to my suite xml file:
java org.testing.TestNG TestSuite.xml
这是我看到的错误:
线程异常主要 java.lang.NoClassDefFoundError:org / testing / TestNG
原因:java.lang.ClassNotFoundException:org.testing.TestNG
我是那些路径和类路径的新手,我有点困惑:(
I'm new in those path and classpath, I'm little bit confusing :(
谢谢
少量更新,
我认为我做得很好,现在当我进入终端时: java org.testng.TestNG Test.xml
我遇到此错误:
Little update,
I think I did all good, now when I put to terminal: java org.testng.TestNG Test.xml
I've got this error:
线程 main中的异常org.testng.TestNGException:未指定sourcedir
在org.testng.TestNG.checkConditions(TestNG.java:1170)
在org.testng.TestNG.privateMain(TestNG.java:1010)在
org.testng.TestNG.main (TestNG.java:997)
Exception in thread "main" org.testng.TestNGException: No sourcedir was specified at org.testng.TestNG.checkConditions(TestNG.java:1170) at org.testng.TestNG.privateMain(TestNG.java:1010) at org.testng.TestNG.main(TestNG.java:997)
所有路径均已导出,因此这可能是 testng的错误版本。 jar
,尝试使用版本 5.5
, 6.4
, 6.5
, 6.6
, 6.7
,但我认为只有版本 5.5
正在工作,
all path are exported, so maybe this is wrong version of testng.jar
, tried with versions 5.5
, 6.4
, 6.5
, 6.6
, 6.7
but I think only version 5.5
is working,
推荐答案
类包
org.testing.TestNG
应为
org.testng.TestNG
(.testng中没有i。部分)
(There no i in the .testng. part)
http:// testng.org/javadoc/org/testng/TestNG.html
这篇关于如何从命令行运行TestNG套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!