Set up Jenkins server for Selenium Regression Suite

In this article, I’m explaining the installation of Jenkins on the Windows server for continuous test automation. My regression suite is based on Selenium, TestNG, Java, and Maven, which is stored in a GitLab repository. Choromedriver will be used as WebDriver for this setup. The installation and configuration of each tool will be described below in detail.

Step 1: Install Java

  • Set JDK bin path in environment variables (add to existing PATH variable)
    PATH=<existing values>;C:\Program Files\Java\jdk1.8.0_261\bin

Step 2: Install Git

  • Download Git (https://git-scm.com/download/win)
  • Install Git on new Server
  • Set git cmd path in environment variables (add to existing PATH variable)
    PATH=<existing values>;C:\Program Files\Git\cmd
  • Setup Git environment (use Git Bash to enter below commands with your user name and email id)
    git config --global user.name “Automation User”
    git config --global user.email “auto.user@mailsrv.vm”
    ssh-keygen -t rsa -b 4096 -C “auto.user@mailsrv.vm”
  • Add above generated public key to GitLab user SSH Keys

Step 3: Install Maven

  • Download Maven (https://maven.apache.org/download.cgi)
  • Extract Binary zip archive (ex: apache-maven-3.6.3-bin.zip)
  • Set maven bin path in environment variables (add to existing PATH variable)
    PATH=<existing values>;C:\Program Files\apache-maven-3.6.3\bin

Step 4: Install Chromedriver

  • Download Chromedriver (https://chromedriver.chromium.org/downloads)
  • Extract Binary zip archive(ex: chromedriver_win32.zip)
  • Set Chromedriver path in environment variables (add to existing PATH variable)
    PATH=<existing values>;C:\MyWork\webdriver\chromedriver_win32

Step 5: Install Jenkins

  • Load Jenkins URL (http://localhost:8080)
  • Unlock Jenkins with initialAdminPassword (C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\secrets)
  • Define password for admin user (inside “Manage Jenkins / Manage Users / Admin / Configure”)
  • Setup Global Tool Configuration (inside “Manage Jenkins”)
  • Manage Credentials (inside “Manage Jenkins”) (use the private key generated in Step 2)

Step 6: Setup Regression Job

  • Create Job “Regression Test” for Maven Project
  • Enter Repository URL and select Credentials
  • Branch to build keep as “master” branch
  • Set a periodically build schedule (ex: run at 6 pm on every Saturday)
  • Enter root pom and maven goal with options
  • Add a post-build action to publish TestNG Results
  • Save settings and execute

Advantages of Automated Regression Test:

This Regression test will be automatically executed weekly as scheduled. You can change or include new tests to the regression suite without changing any configuration on Jenkins. Once you push new changes to GitLab, those changes will automatically reflect in the next test execution cycle.

Software Testing Specialist — API / UI (Autoamation / Manual)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store