使用TestNG执行自动化代码时出错:找不到或加载主类org.testng.TestNG

时间:2019-03-15 11:09:36

标签: testng

使用TestNG手动执行可以很好地执行我的测试自动化项目,但是无法使用命令行执行它。我做了以下事情:

1. set ProjectPath=C:\eWorkspace\myProduct\Obaid\Lexus
2. set classpath=%ProjectPath%\bin;%ProjectPath%\Lib\*
3. java -cp "C:\Software\TestNG\testng-6.9.9.jar;C:\eWorkspace\myProduct\Obaid\Lexus\bin\Tests" org.testng.TestNG %ProjectPath%\XMLs\Lexus\Lexus.xml
3.a. Error gets thrown: Getting error Could not find or load main class org.testng.TestNG

4. java -cp C:\eWorkspace\myProduct\Obaid\Lexus\Libs\TestNG\;C:\eWorkspace\myProduct\Obaid\Lexus\bin\Tests\ org.testng.TestNG %ProjectPath%\XMLs\Lexus\Lexus.xml
4.1. Error gets thrown: Getting error Could not find or load main class org.testng.TestNG

尝试了许多其他方法来执行此操作。

在StackOverflow和其他地方引用了许多其他文章: 1. JNI error has occurred. Please check your installation 2. http://qtp-automate.blogspot.com/2011/10/running-selenium-testng-test-from.html 3. Getting error Could not find or load main class org.testng.TestNG

此外,随附的是我的项目层次结构的屏幕截图。

My Projects Screenshot

0 个答案:

没有答案