'How can we run TestNG from command promt
I am beginner for TestNG automation scripts when I run my testing.xml in eclipse its working good. But I am not able to run my scripts via command prompt since week and its giving me error as below can some one guide me how can I run my scripts via command prompt.
testing.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestBatch">
<suite-files>
<suite-file path="./com.automatics.data/com/automatics/data/temp/TV_API_Dev2.xml"/>
</suite-files>
</suite>
TV_API_Dev2.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" parallel="tests" verbose="1" name="EPO_API">
<test name="Tv_E2E">
<classes>
<class name="com.automatics.packages.testScripts.Tv_GCD/>
<class name="com.automatics.packages.testScripts.Tv_VAQ"/>
<class name="com.automatics.packages.testScripts.Tv_SM"/>
<class name="com.automatics.packages.testScripts.Tv_CUId"/>
<class name="com.automatics.packages.testScripts.Tv_SO"/>
</classes>
</test>
</suite>
Command prompt
java -cp "*H:\Automation\automation\Automation" org.testng.TestNG testng.xml
Solution 1:[1]
I saw your comment
I do not have
.liband.binfolders in my project
if you do not have one, then you will have to create one.
Once the TestNG plugin is downloaded from Eclipse marketplace.
After adding TestNG to your project library create one folder in your Project names as lib ( name can be anything ) :
Go to "
C:\Program Files\Eclipse\eclipse-java-mars-R-win32-x86_64\eclipse\plugins" location and copy com.beust.jcommander_1.72.0.jar and org.testng_6.14.2.r20180216145.jar file to created folder (lib).
Note: Files are testng.jar and jcommander.jar
- Now Launch CMD, and navigate to your project directory and then type :
Java -cp C:\Users\User123\TestNG\lib*;C:\Users\User123\TestNG\bin org.testng.TestNG testng.xml
That's it !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cruisepandey |
