如何通过命令提示符运行testng

时间:2013-03-30 17:15:26

标签: testng

请告诉我如何通过命令行运行testng

当我运行以下命令时

java org.testng.TestNG TestNG.xml    

获取如下错误

Error: Could not find or load main class org.testng.TestNG

这意味着我们必须在运行测试之前编译吗?

1 个答案:

答案 0 :(得分:-1)

请在ClassPath of System中添加TestNG Jar的完整路径,然后就可以了。像这样:

  

C:\ ProgramData \甲骨文\爪哇\ javapath;%SYSTEMROOT%\ SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\ System32下\ WBEM;%SYSTEMROOT%\ System32下\ WindowsPowerShell \ V1.0 \;%JAVA_HOME%\ bin中; C:\ Program Files \ TortoiseSVN \ bin; C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn \; C:\ Program Files(x86)\ Microsoft SQL Server \ 110 \ Tools \ Binn \; C: \ Program Files \ Microsoft SQL Server \ 110 \ DTS \ Binn \; C:\ Program Files(x86)\ Microsoft SQL Server \ 110 \ Tools \ Binn \ ManagementStudio \; C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PrivateAssemblies \; C:\ Program Files(x86)\ Microsoft SQL Server \ 110 \ DTS \ Binn \; C:\ Program Files \ SourceGear \ Common \ DiffMerge \; C:\ Users \ 105451 \ Downloads \压缩\ testng-6.8.7.jar