I need help to create a .bat
file to invoke testng.xml
which has all the tests to run.According to this link, I created the .bat
file. Here is what I have written in it:
我需要帮助来创建一个.bat文件来调用testng.xml,它运行所有测试。根据这个链接,我创建了.bat文件。这是我写的内容:
java -cp "C:\Program Files\Selenium Execution Engine\lib\library\testng-5.8-jdk15.jar";"C:\POM_Newdemo\EF_Progression\bin\testscripts" org.testng.TestNG "C:\POM_Newdemo\EF_Progression\testng.xml"
where:
-
-cp
: is class path -
C:\Program Files\Selenium Execution Engine\lib\library\testng-5.8-jdk15.jar
: is the path of my testng jar file -
C:\POM_Newdemo\EF_Progression\bin\testscripts
: is the path of my .class files of my tests -
C:\POM_Newdemo\EF_Progression\testng.xml
: is the path of mytestng.xml
file
-cp:是类路径
C:\ Program Files \ Selenium Execution Engine \ lib \ library \ testng-5.8-jdk15.jar:是我的testng jar文件的路径
C:\ POM_Newdemo \ EF_Progression \ bin \ testscripts:是我测试的.class文件的路径
C:\ POM_Newdemo \ EF_Progression \ testng.xml:是我的testng.xml文件的路径
It is throwing error as follows:
它抛出错误如下:
[Parser] Running:
C:\POM_Newdemo\EF_Progression\testng.xml
Suite
Total tests run: 0, Failures: 0, Skips: 0
[ERROR]:
Cannot find class in classpath: testscripts.Test_Demo
Please let me know how to resolve this error.
请让我知道如何解决此错误。
2 个解决方案
#1
0
Please try the following. If it does not work provide the full path of test.xml file.Please do let me know if it worked
请尝试以下方法。如果它不起作用提供test.xml文件的完整路径。请告诉我它是否有效
java -cp "C:\Program Files\Selenium Execution Engine\lib\library\testng-5.8-jdk15.jar":C:\POM_Newdemo\EF_Progression\src\testscripts" org.testng.TestNG testng.xml
#2
0
1| Copy any one of the below methods in a text file
2| Save it as yourtext.bat
3| Open the batch file created to run the test.
Method #1
cd C:\Workspace\projectname
java -cp C:\Workspace\projectname\lib\*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml
Method #2
cd C:\Workspace\projectname
set ProjectPath=C:\Workspace\projectname
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml
#1
0
Please try the following. If it does not work provide the full path of test.xml file.Please do let me know if it worked
请尝试以下方法。如果它不起作用提供test.xml文件的完整路径。请告诉我它是否有效
java -cp "C:\Program Files\Selenium Execution Engine\lib\library\testng-5.8-jdk15.jar":C:\POM_Newdemo\EF_Progression\src\testscripts" org.testng.TestNG testng.xml
#2
0
1| Copy any one of the below methods in a text file
2| Save it as yourtext.bat
3| Open the batch file created to run the test.
Method #1
cd C:\Workspace\projectname
java -cp C:\Workspace\projectname\lib\*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml
Method #2
cd C:\Workspace\projectname
set ProjectPath=C:\Workspace\projectname
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml