1- Download Jenkins
Step
1- Open your web browser and then Navigate to Below URL
http://jenkins-ci.org this is the official website of Jenkins
http://jenkins-ci.org this is the official website of Jenkins
Step 2- Now download Jenkins.war file and save into desktop or any other location depends on your choice
Step
3- Once download complete. You will get Jenkins.war file that we need to execute
Go to the location
where Jenkins.war is available. In my case, I kept in my project home directory
Open Command prompt knows as CMD
and navigate to project home directory and Start Jenkins server
Start- cmd>
Project_home_Directory> java -jar Jenkins.war
Step 3-
Once Jenkins server is up and running, you will get above
success message.
By default Jenkins runs on 8080 port so you can navigate to below URL for Jenkins UI
Open any browser and type the URL http://localhost:8080
By default Jenkins runs on 8080 port so you can navigate to below URL for Jenkins UI
Open any browser and type the URL http://localhost:8080
Now Jenkins in up and running so
now we have to configure Jenkins so that we can execute our test case via
Jenkins.
Step 4-
Once Jenkins is running so we are
almost done but before moving to create build we need to configure Jenkins so
that Jenkins can identify other tools as well like Java, Maven etc.
Click on > Manage Jenkins
Click on Configure
System
Here we are telling Jenkins that
our java is located at this location so we don’t have to worry about the
explicit path.
Navigate to JDK section and Click
on Add JDK button
Uncheck Install
automatically check box so Jenkins will only take java which we have mentioned
above.
Give the name as
JAVA_HOME and Specify the JDK path
In Jenkins, we have a very good feature that you can
configure email notification for the user.
This is optional but if you want
to configure Email notification then you have to do little setting while
configuring Jenkins
Once done click on save and apply.
Congrats, your Jenkins is
configured now.
Part
3- Execute Selenium build using Jenkins
We can execute test cases in
Jenkins using 4 ways refer the below screenshot
In this post, we will execute using Window batch command
Step 1- Create a
batch file first then we will add the same batch file to Jenkins
a-To create the batch file we
need to set classpath of TestNG so that we can execute testng.xml files
our project structure should look
like
b-
Open command prompt and set the classpath-
While setting classpath we will
set the path of bin folder and libs folder (inside libs we have all libraries)
Home directory > set
classpath=C:\Users\Learn-automation\bin;C:\Users\Learn-automation\libs\*;
Note- Please make the changes as
per your system
c- Open notepad and type the below
command and save as .bat file –
In my case, I have saved as
run.bat
java -cp bin;libs/*
org.testng.TestNG testng.xml
Step 2-
Create a job in Jenkins which
will execute our build
Open Jenkins on browser (type http://localhost:8080)
Open Jenkins on browser (type http://localhost:8080)
a- Click on the new item
b- Give the Job-Name,
select Build a free-style software project and Click on OK button
c- Navigate to Advanced
Project Options > Check the use custom workspace > in directory we will
specify the project home directory
d- Important part now
specify the Add Build step >Click on Execute Windows batch command
e-In the section please
specify the batch file which we created and click on Apply and save
Step 3- you can finally run the Build > Click on Build now
option
Step 4- Check Build history and Console output and verify the output
Part
4-Schedule your build in Jenkins for periodic execution
Jenkins comes with very good
functionality in which we can schedule jobs which we created
You can schedule build for
existing jobs which already created and while creating new project also we can
specify the same.
Let’s schedule the job. Refer the
below screenshot
Step 1-
Open job which we created now and
Click on configure > select the check box build periodically
Step 2-
Specify the time here we need to
careful about the syntax
Jenkins works on Cron pattern for
more info about cron refer cron link http://en.wikipedia.org/wiki/Cron
Jenkins will accept 5 parameter
lets discuss one by one
* * * * *
Here the first parameter- specify
minute and range will vary from 0-59
Here the second parameter-
specify hours and range will vary from 0-11
Here the third parameter- specify
day and range will vary from 0-7 here 0 and 7 will be Sunday
Here the fourth parameter-
specify month and range will vary from 1-12
Here the fifth parameter- specify
year so here you can specify *
Example 1- if you specify
00 22 * * * it means your build will run daily @ 10 PM
Example 2- if you specify
50 * * * * it means your build will run daily 50 min
after every hour
Example 3- if you specify
00 22 1 * * it means your build will run every Monday @ 10 PM
Finally, we have
executed our test case successfully.
Did you know there's a 12 word sentence you can communicate to your partner... that will trigger deep feelings of love and impulsive attractiveness for you buried inside his chest?
ReplyDeleteThat's because deep inside these 12 words is a "secret signal" that triggers a man's impulse to love, please and care for you with his entire heart...
12 Words Will Trigger A Man's Desire Response
This impulse is so built-in to a man's mind that it will make him work better than ever before to build your relationship stronger.
Matter of fact, triggering this all-powerful impulse is absolutely important to getting the best possible relationship with your man that as soon as you send your man one of the "Secret Signals"...
...You'll instantly notice him open his soul and mind to you in a way he never expressed before and he'll identify you as the one and only woman in the world who has ever truly interested him.