How to run a Selenium Project from Jenkins [Continuous Integration Tool] with Extent Report Setup

What is Jenkins?

Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies.


Steps To Download Jenkins

  • Download jenkins.war file from https://updates.jenkins-ci.org/download/war/ 
  • Place the jenkins.war file in a folder (i.e. C:\jenkins\)
  • Now open command prompt and write cd C:\jenkins\ to navigate to the folder where "jenkins.war" file is located.
  • Now write java -jar jenkins.war and press Enter


















  • Once you see the below message then you can get started with Jenkins by using HTTP://localhost:8080 URL.






  • After completing the Jenkins installation process, a browser tab will pop-up asking for the initial Administrator password. 
  • The initial Administrator password should be found under the Jenkins installation path (set at Step 4 in Jenkins Installation).
  • For default installation location to C:\Program Files (x86)\Jenkins, a file called initialAdminPassword can be found under C:\Program Files (x86)\Jenkins\secrets.
  • However, If a custom path for Jenkins installation was selected, then you should check that location for initialAdminPassword file.

















  • Open the highlighted file and copy the content of the initialAdminPassword file














  • Click on the "Install suggested plugins button" so Jenkins will retrieve and install the essential plugins













  • Jenkins will start to download and install all the necessary plugins needed to create new Jenkins Jobs.













Note: You can choose the Option "Select Plugins to Install" and select the plugins you want to install
  • After all suggested plugins were installed, the "Create First Admin User" panel will show up. Fill all the fields with desired account details and hit the "Save and Finish" button.















  • Once you have filled the above data, finally it will ask for URL information where you can configure the default instance path for Jenkins. Leave it as it is to avoid any confusions later. However, if another application is already using 8080 port, you can use another port for Jenkins and finally save the settings, and you are done with installation of Jenkins. Hit the "Save and Continue" button.












Congratulations! We have successfully installed a new Jenkins Server. Hit the "Start using Jenkins" button.


















Below you can find the Jenkins instance up and run, ready to create first Jenkins jobs:













  • Click on "New Item" and enter "Item Name" e.g. Flight Reservation (POM) and select "Freestyle project" and click on "OK" button








  • Click on "Advanced" button












  • Select "Use custom workspace" checkbox and enter the path where batch file is located in your local system or server in the "Directory" edit field. In our case it is "testRunner.bat" which is located at "H:\Workspace_Selenium\FlightReservation(POM)"













NOTE:  If you don't know how to create a project and initiate execution from a batch file then please refer 


  • Click on "Add build step" drop down and select "Execute windows batch command"













  • Enter batch file name (in our case it is testRunner.bat) in the Command text area and click on "Apply" button.














Now Our Job is ready to be run.

  • Click on the project [Flight Reservation(POM)] to navigate to the project dashboard.












Extent Report Setup
=================
  • Click on "Back to Dashboard" link









  • Make sure that "HTML Publisher" plugin must be installed. 
  • Click on "Manage Jenkins"
  • Click on "Script Console" link displayed in the "Manage Jenkins" page.
  • write System.setProperty("hudson.model.DirectoryBrowserSupport.CSP",""); in the text area and click on "Run" button.










  • Navigate to the Project Dashboard and click on "Build Now" to start execution.

Comments

  1. Thank you so much for sharing this article withus. I really liked it and the images you have used are easy to understand and they make your article attractive and eye catchy.

    Selenium automation testing

    ReplyDelete
  2. Thanks for sharing informative blog....it is useful information..
    selenium online training in hyderabad

    ReplyDelete

Post a Comment

Popular posts from this blog

Encoding and Decoding in Selenium using Base64 Class of Java

Parallel Execution In TestNG Framework Using ThreadLocal Concept

How to handle calendar or date picker using dynamic XPATH?