MainMenu

Home Java Overview Maven Tutorials

Friday, 24 November 2017

Selenium Integration with Jenkins Tutorials 1




For Video : CLICK HERE For Video Tutorials Playlist



Jenkins Introduction :


OPEN SOURCE AUTOMATION SERVER which can be used to automate all sorts of task such as Building, testing and deploying Software.
Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of platform you are working on.
It is a free source so it an handle any kind of build integration.

Why Jenkins :


It is Easy to Install.
It has a lot of plugins which make task Easy.
It is build in java so it is Portable to all the major plateforms.
Jenkins is a software that allows continuous integration.

What is flow in jenkins :


Developers check their code & made changes as required
Jenkins will pick the changed source code and trigger a build and run any tests if required.
The build output will be available in the jenkins dashboards, automatic notifications can also be sent back to the developer.

What is continuous Integration :


Continuous Integration is a development practice in which the developers are required to commit changes to the source code in a shared repository several times in a day or with regular interval.
After that a job will get triggered by jenkins and create build.
This concept was meant to remove the problem of finding later occurrence of issues in the build lifecycle.

Here is the work flow of the CI :




What is continuous Integration ?

Continuous Integration is a development practice in which the developers are required to commit changes to the source code in a shared repository several times in a day or with regural interval.
After that a job will get triggered by jenkins and create build.
This concept was meant to remove the problem of finding later occurrence of issues in the build lifecycle.

on other hand you can say CI is just : Build & Test


Use of Continuous Integration

)1. : Automate the Build
)2. : Make the Build self Testing
)3. : Keep the Build Fast
)4. : Everyone can see what's happening.
)5. : This allow the team to detect the problems early.

Other Tools which support CI :


Jenkins
Teamcity
Go CD
Bamboo
Gitlab CI

Workflow in continuous integration




Before Continuous Integration :
The entire source code was built and then tested.
Developers have to wait for test results.
No Feedback

After Continuous Integration :
Every commit made in the source code is build and tested.
Developers know the best result of every commit made in the source code on the run.
Feedback is present.

Download Jenkins : Click here to go to Download Page

Download Jenkins for windows : Click here Download zip file

Download Jenkins : Click here to Download war file

Now download and install the jenkins in your machins task is done.

After that you will get below window



You need to enter the password present in appropriate location.

Jenkins will ask you, whether you want to create a user or continue with admin user
for admin user username & password will be admin
but in my case i will create a user so below window will appear



I will fill the required details & click on the next button after that below window will appear to install the plugins, your can select the plugins as per your need or you can select the default option which is install suggested plugins




It will take little bit time and after that your jenkins dashboard will appear at the location http://localhost:8080



Alternatively you can also install the jenkins in your machine using war file & cmd.
Open your command promt
navigate to jenins war file location using cd etc basic commands
not type commandjava -jar jenkins.war and hit enter key as below in image


congratulation jenkins is not installed in your machine.



How to Change port number in jenkins?


There is only one line commond to change the port number in jenkins :
java -jar jenkins.war --httpPort=8081

How to restart the Jenkins?


There is two ways to re-start the jenkins :
1): from browser :
write the below commond & hit enter
http://localhost:8080/restart

2): In windows machine :
Press win + r
type services.msc
find the jenkins & right click on it
There will be restart option , just press on it

Why do we need to change the home directory in jenkins?


1): Due to less space in user directory.
2): Due to project requirement.
3): Confliction with other app.

How to change home directory in Jenkins ?


You need to follow some couple of steps to change the home directory of jenkins :
1): Find the existing directory of jenkins
generally it is inside C , User directory & in my case it is :
C:\Users\chandan.singh\.jenkins
OR
from jenkins, you will also get Jenkins home directory
http://localhost:8080 >> manage jenkins >> Configure jenkins >> First option will be home directory

2): Create a new folder, where you want to have the home directory.
in my case
D:\Automation\Jenkins_Home

3):Now copy all the data from Old directory by pressing "Ctrl" + "A" and paste ("Ctrl" + "A") in new directory

4):Now change the Environment Variable

5): My computer , right click on it & select Properties
and select Advanced System setting
a pop will appear , click on Environment varable
under system variable find JENKINS_HOME & click on Edit button
Note : (if not available then click on Add button & add this as below image )
In path enter the new directory path, in my case it is
D:\Automation\Jenkins_Home
click on OK & OK
Now restart your jenkins & check the new directory.


Configure Email Smtp server details :

Outlook.com SMTP Server Settings

Outlook.com SMTP server address: smtp-mail.outlook.com
Outlook.com SMTP user name: Your full Outlook.com email address (e.g. myname@outlook.com, not an alias)
Outlook.com SMTP password: Your Outlook.com password
Outlook.com SMTP port: 587 (you can use port 25 as an alternative)
Outlook.com SMTP TLS/SSL encryption required: yes

Yahoo SMTP Server Settings

Yahoo! Mail SMTP server address: smtp.mail.yahoo.com
Yahoo! Mail SMTP user name: Your full Yahoo! Mail email address (including "@yahoo.com")
Yahoo! Mail SMTP password: Your Yahoo! Mail password
Yahoo! Mail SMTP port: 465
Yahoo! Mail SMTP TLS/SSL required: yes

Yahoo! Mail Plus SMTP Server Settings

The SMTP server settings for Yahoo! Mail Plus accounts (which no longer exist) were:
Yahoo! Mail SMTP server address: plus.smtp.mail.yahoo.com
Yahoo! Mail SMTP user name: Your Yahoo! Mail user name
Yahoo! Mail SMTP password: Your Yahoo! Mail password
Yahoo! Mail SMTP port: 465
Yahoo! Mail SMTP TLS/SSL required: yes

How to schedule the build in jenkins

Jenkins scheduler watch work on Cron Time Format.
What is Cron : a command to an operating system or server for a job that is to be executed at a specified time.



For Example : i want to run my build on 10:06 PM on 15 Jan then my command/time format will be :-
06 22 15 1 1 (Refer the below screen)
Explanation : in above time format 06is for Minute, 22 is for Hour, 15 for date of month,1 for month of year & 1 for day of week.

Jenkins Dashboard >> Click on your project >> Click on Configure >> Go to Source code Management Tab >> Under the build Triggers >> click on Build periodically checkbox >> In the Textbox input your schedule time in cron time format
Refer the below screen :







Tags :

How to change directory in jenkins

How to change port number in jenkins

How to restart jenkins

How to send emails from Jenkins

How to send emails when build is success

Send build success email from jenkins

What is Jenkins

Selenium Integration with jenkins

jenkins tutorial 2017

What is continuous Integration?

What is use of continuous Integration?

How to schedule test with jenkins

How to schedule test with jenkins in selenium

No comments:

Post a Comment