如何从命令行运行TestNG套件

时间:2013-04-24 18:29:37

标签: selenium command-line webdriver testng

我想在Linux上从命令行运行TestNG Suite。我正在使用eclipse运行测试,但我遇到命令行问题。我知道我需要有testng.jar并且我在/home/karcio/dev/testng-6.4.jar中找到它,我的套件xml是/ home / karcio / git / java-test-automation / Automation / test- output / Default suite / TestSuite.xml。命令我试过的,

  1. 设置classpath /home/karcio/dev/testng-6.4.jar
  2. cd / location to my suite xml file:java org.testing.TestNG TestSuite.xml
  3. 这是我看到的错误:

    线程“main”中的异常java.lang.NoClassDefFoundError:org / testing / TestNG 引起:java.lang.ClassNotFoundException:org.testing.TestNG

    我是那些路径和类路径的新手,我有点困惑:(

    谢谢

    小更新, 我觉得我做得很好,现在当我放到终端:java org.testng.TestNG Test.xml 我有这个错误: 线程“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)

    所有路径都被导出,所以这可能是错误的testng.jar版本,尝试使用版本5.5,6.4,6.5,6.6,6.7,但我认为只有5.5版正在运行,

1 个答案:

答案 0 :(得分:4)

课程包中有拼写错误 org.testing.TestNG

应该是 org.testng.TestNG

(.testng。部分没有我)

http://testng.org/javadoc/org/testng/TestNG.html