Tuesday, 24 March 2015

Running testng class file from cmd prompt and jenkins

we can run the testng class files through eclipse by adding the testng libraries in Build path.
If we need to run the same testng class files from command prompt and through any tools we could do so by adding the testng libraries to the CLASSPATH variable. or by giving the path with -cp option available in java. Also can add any jar files which are referred in the class files.



set CLASSPATH = %CLASSPATH%;D:\Are\Sel\Ecom_project\TestNG\testng-6.8.jar

D:\Area\Sel\>java org.testng.TestNG testng.xml
[TestNG] Running:
  D:\Are\Sel\Ecom_project\src\scripts\testng.xml

TestNG is working fine
===============================================
Suite1
Total tests run: 1, Failures: 0, Skips: 0
===============================================



To run the same testng scripts via Jenkins can add the CLASSPATH variable at master level or at node level specifying the path of the jar files. Represented the same in below snaps.










 

No comments:

Post a Comment