|How to run TestNG test in cmd||Grega G.||8/9/11 3:36 AM|
I run my tests under Eclipse with TestNG. I have two files. First I
have .java class and the second file is testng.xml.
I run my test through the Eclipse where I run my .xml file. But now I
would like to do so that I could run my test in cmd.
Any suggestion how to do that??
|Re: [testng-users] How to run TestNG test in cmd||Krishnan||8/9/11 8:47 AM|
My humble apologies for not responding to your personal note in time earlier (Was stuck with some other stuff and was also trying to figure out this myself)
Here's how you can do it:
Download the testng jar from : http://testng.org/doc/download.html
Create a batch file which will have the following:
java -cp testng-6.1.1.jar;projects\MyProject\target\test-classes org.testng.TestNG projects\MyProject\src\test\resources\MyCustomSuite.xml
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<parameter name="environment.toRun" value="QA" />
<test name="Test1" preserve-order="true">
If you would like to have the capabilities of kicking off runs from outside eclipse, you should seriously consider build tools such as either Ant or Maven.
[ I have been using only Maven, which is why it took me sometime to figure out how to make use of just java and get the execution done from the command line. But it was a good learning :) ]
For using Ant to get your executions done, please read more at : http://testng.org/doc/ant.html
For using Maven to kick off your testng executions, please read more at : http://testng.org/doc/maven.html
Thanks & Regards
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"