0

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
Krish
  • 4,166
  • 11
  • 58
  • 110

1 Answers1

0

I saw your comment

I do not have .lib and .bin folders 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.

  1. After adding TestNG to your project library create one folder in your Project names as lib ( name can be anything ) :

  2. 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

  1. 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 !

cruisepandey
  • 28,520
  • 6
  • 20
  • 38