In this blog I will give basic information about jenkins. Lets get started….
Let us understand what jenkins is and why we need jenkins.
Jenkins is an open-source Continuous Integration server written in Java for orchestrating a chain of actions to achieve the Continuous Integration process in an automated fashion. Jenkins supports the complete development life cycle of software from building, testing, documenting the software, deploying, and other stages of the software development life cycle.
I think you have a question in your mind that what is continuous integration? So lets see what is Continuous integration.
What is Continuous Integration?
Continuous Integration is a process of integrating code changes from multiple developers in a single project many times. The software is tested immediately after a code commit. With each code commit, code is built and tested. If the test is passed, the build is tested for deployment. If the deployment is successful, the code is pushed to production. This commit, build, test, and deploy is a continuous process and hence the name continuous integration/deployment.
The below image will help you to understand the flow of jenkins in Software Development lifecycle.
Now let us see how to install jenkins in our system.
Steps to install Jenkins:
• Goto this URL --- https://www.jenkins.io/download/
• Current Jenkins version can support java 8 and java 11 only. So before installing please check your java version.
• Pickup always a stable version(LTS) of Generic java package(.war) file, installation will be same for mac ,windows or any other. click on windows for download jenkins war file.
• once download is finished you will see that file is in downloads on your system.
• open the command prompt in the downloads location.
• Run the command java -jar jenkins.war –httpPort=8080
• Whenever you have installed Jenkins first time in your system you will see Jenkins password in the location C:\Users\admin\.jenkins\secrets\initialAdminPassword then copy that password.
• Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears then paste the password and then click continue.
Now Customize Jenkins page appears. Here you can install any number of useful plugins but for now you can select install suggested plugins. Then jenkins asks you to create your first administrator user, now you can give all your details and then click on save and finish.
Then above welcome page can appears in your system .Whoa! we have successfully installed jenkins in our system. Now let us understand how to run selenium automation tests in jenkins.
Run Automation Tests in Jenkins:
Before creating a project in Jenkins we need to add maven plugin, because our selenium projects are based on maven, for this we need to goto manage Jenkins.
Now gotomanage plugins and now search for maven and then select all maven options like maven integration plugin , maven artifact choicelistprovider, maven release plugin etc.. And then install all these plugins and then try to restart your Jenkins.
Steps to run tests in jenkins:
1.we need to create a project, for this we need to click on new item button which is in the top left to jenkins page.
2.Here we should give a project name and if you want to create a maven project you can select maven project then click on ok.
3.First we need to give a little description related to our project.
4.Then keep all options as it is, since we are creating a basic selenium project so no need to change any thing.
5.Now you can see “Jenkins needs to know where maven is installed” message in build section. Below that you can see “ the tool configuration”, just click on it.
6.Then scroll until “add maven” button will appear. click on add maven button. You can give any name and save it.
7.Then give your pom.xml file location which is in your project into root pom .
8.Then enter “clean install” in Goals and options and now save it. Then your project got created.
9.Then click on build now option which is present in the left side of the Jenkins page.
10.Then your project starts executing, that you can see in the build history.
11.Then you can click on your first build then a new window will appear.
12. Click on console output ,where you can see how your project is executing.
13.Once execution is completed you can see more sections. In that click on test result where you can see how many test cases got passed ,failed and also all details of our project execution.
Comments