To test and build the software continuously, Bugraptors also uses Jenkins to easily identify the changes in the project. Jenkins is a very famous open source tool that performs continuous integration and delivery of projects.
2. Introduction
Jenkins is a very famous open source tool that performs continuous
integration and delivery of projects. Nowadays most of the software
companies use/integrate Jenkins into large number of deployment and testing
technologies. The role of the Jenkins is to test and build the software
continuously making it easier to identify the changes in the project.
Using Jenkins, Continuous integration is achieved with the help of plugins. To
integrate the needed tool, you just need to install the plugin for that particular
tool.
3. Howto start work on Jenkins?
If you don't have Jenkins account firstly create a new account on Jenkins and
then follow the below mentioned steps.
Login into Jenkins:
After installation, if you start Jenkins locally, go to
“http://localhost:8080/login” URL. Note that the default port of Jenkins is:
8080.
If you have not set the credentials before Jenkins installation, then it will be:
Username: admin
Password: Go to your “C: JenkinssecretsinitialAdminPassword” for
password
After login, you will be displayed "Welcome to Jenkins!" message.
4. Howto Install Plugins in Jenkins?
Below are the steps to install SVN plugins in Jenkins:
On the Dashboard, there is an option ‘Manage
Jenkins’, click on it.
In the next screen, select the Manage Plugins option
and then click on Available tab.
Listing of plugins will be displayed which are
available for downloading.
In the ‘Filter' or search field type ‘SVN’.
The available tab will be filtered out according to the
searched text.
Check the required plugins checkboxes.
Click on the ‘Install without restart' button.
5. Check the checkbox ‘Restart Jenkins when
installation is complete and no jobs are
running'.
OR
Once all the installations are completed,
restart Jenkins by issuing the following
command in the
browser ‘http://localhost:8080/jenkins/re
start’.
After restarting Jenkins, go to the Installed
tab, and verify the downloaded plugins
that should be under this tab.
6. Howto Create New Job in Jenkins?
Follow the below mentioned steps:
• Click on Create new Job link on Jenkins dashboard screen.
• In the next Screen, Enter a name in Enter an item name textbox.
• Click on OK button.
• Click on Source Code Management tab.
• Check Subversion checkbox.
• Enter SVN path in Repository URL.
• Click on Add button to Credentials label.
• Click on Jenkins.
• Enter SVN Credentials.
• Click on Add button.
• After filling valid Repository URL and Credentials, Subversion tab will
display without error.
7. Now I will run the build. Following are the ways to run the build like: cmd,
batch file, ant file, and direct entering the command in Build editor box etc.
But here I will run the build from the Batch file.
Create batch file (Reference link: http://www.seleniumeasy.com/testng-
tutorials/how-to-run-testng-xml-via-batch-file-example).
Put the created batch file in C:Jenkinsworkspace.
Select Execute Windows batch command in Build section of Jenkins.
Now enter the batch file path in Command text editor in the Build section of
Jenkins.
Click on Apply, and then Save.
Click on Build Now on the left side of the screen.
See the build in build history, if it is in Red color means it is FAIL while the
Blue color indicates that it is PASS.
8. How to SendEmail notification in Jenkins?
In Jenkins, we can send Build status email notifications to single and multiple
recipients.
Single Recipient:
1. Enter the Recipient email address in Recipients textbox.
2. Firstly, click on ‘Apply’ and then ‘Save’ button.
3. Go to http://localhost:8080/configure.
4. Enter SMTP server in E-mail Notification Section.
5. Click on ‘Apply’ and then ‘Save’ button.
6. Click on Build Now on the left side of the screen.
7. See the build in build history, if it is in Red color means it is FAIL if it is in
Blue color means it is PASS.
8. Check the Recipient’s email account if he/she received the build status
email notification.
9. Multiple recipients:
1. Install the email-ext. plugin from Manage Plugins.
2. Now add the multiple recipients in Recipients textbox as
test@gmail.com, test1@gmail.com and so on.
3. Click on ‘Apply’ and then ‘Save’.
4. Go to ‘http://localhost:8080/configure’.
5. Enter SMTP server in Extended E-mail Notification Section.
6. Click on ‘Apply’ and then ‘Save’.
7. Click on Build Now on the left side of the screen.
8. See the build in build history, if it is in Red color means it is FAIL if
it is in Blue color means it is PASS.
9. Check the Recipients email account. They all should have received
the build status email notification.
10. Howto send Build.log file in email?
1. Install the email-ext. plugin from Manage Plugins.
2. Go to the ‘http://localhost:8080/configure’.
3. Enter SMTP server in Extended E-mail Notification Section.
4. Click on ‘Apply’ and then ‘Save’.
5. Go to your projects configure page and Select Post-build Actions tab.
6. Select Editable Email Notification.
7. Now add the recipients to Project Recipient List text box.
8. Click on Attach Build Log drop-down.
9. Select Attach Build Log option.
10. Click on Advanced Settings button.
11. Click on Add Trigger drop-down.
12. Click on Always option.
13. Click on ‘Apply’ and then ‘Save’.
14. Now Click on Build Now.
15. Check Console output and received email.