我如何从命令行运行.java TestNG项目?
我已经阅读了TestNG文档,并尝试了以下操作但无济于事:
C:\projectfred> java org.testng.TestNG testng.xml
...在我的项目中带有以下testng.xml文件:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="SuiteAll" verbose="1"> <test name="TestAll"> <packages> <package name="com.project.fred.tests"/> </packages> </test> </suite>
我得到的错误是这样的:
Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/TestNGCaused by: java.lang.ClassNotFoundException: org.testng.TestNG at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)Could not find the main class: org.testng.TestNG. Program will exit.
显然,我在命令行中没有正确引用TestNG。有谁知道如何使它工作?
白板的微信
相关分类