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
techg

Create a testng test case and write basic program

ngs

·         Create testng xml file and call above test case

hg

Project hierarchy:

sample
·         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
sou

·         Once it got created it will display as below

JN10

·         We need to create this file within the project location

JN11

Add testng tests to Jenkins:

 

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

4.      Hit ok button at the botton 

JN14

5.      Click on advanced

JN15

  6.      Select use custom workspace checkbox

JN16

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

JN17

  8.      Click on add build steps from build options 

JN18
9.      Select “Execute window batch command” 
 
JN19

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

nst

11.      Click on save button below screen will display

snt
error: Content is protected !!