Jenkins: Create TESTNG batch file for JENKINS

Jenkins: Create TESTNG batch file for JENKINS

Steps :

 

·         Create a JAVA project and add selenium libraries to that project

Create a testng test case and write basic program

·         Create testng xml file and call above test case

Project hierarchy:

·         Open notepad
·          
·         Paste below code into the notepad:
set projectLocation=C:\Projects\Sample
cd %projectLocation%
set classpath=%projectLocation%\bin;%projectLocation%\lib\*
java org.testng.TestNG %projectLocation%\testng.xml
·         Give unique name.bat  as below

·         Once it got created it will display as below

·         We need to create this file within the project location

Add testng tests to Jenkins:

 

Steps:
1.      Once after we successfully logged into Jenkins using http://localhost:8080 you can see below screen
   2. Click on create new jobs
3.      Give  a name and select “Free style project” as below
 

4.      Hit ok button at the botton 

5.      Click on advanced

  6.      Select use custom workspace checkbox

 7.      Enter project location to the text field as below: 

  8.      Click on add build steps from build options 

9.      Select “Execute window batch command” 
 

10.      Specify the batch which we created for testng and specify the name of that file here. 

11.      Click on save button below screen will display

error: Content is protected !!
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare