Automation Configuration Using Jenkins

Follow the below steps.

Step #1 Software installations required

  • Download and install Java from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/index.html).
  • Download Apache Maven version 3.0.4 from Maven website (https://maven.apache.org/download.cgi)
  • Download and install Tortoise git from Git Home Page (https://tortoisegit.org/download/)
  • Download the Jenkins War file from Jenkins Homepage (https://jenkins.io/index.html)

Step #2 Starting Jenkins

  • Start Jenkins directly via the command line using the following command.
    1. Java -Dhudson.model.DirectoryBrowserSupport.CSP=  -jar Jenkins. War  
    2. (Intentionally we are providing no values for Dhudson.model.DirectoryBrowserSupportby assigning a blank. This is required to get test reports with screenshots and pie charts. Don’t delete the space after CSP=)  

Step #3 Configuring software on Jenkins

Select "Manage Jenkins" and afterward, configure the system.

Jenkins

Jenkins

  • Configuring JDK

    1. Go to Jenkins and navigate to Manage Jenkins -> Configure System.
    2. Click "JDK installations".
    3. Add "JDK".
    4. Uncheck "Install automatically" (do this if JDK is available in your system or else check "Install automatically" and ignore the below steps).
    5. Provide JDK name (available from the drop-down list).
    6. Provide JDK home directory path.

      Jenkins

  • Configuring maven

    1. Go to Jenkins and navigate to Manage Jenkins -> Configure System.
    2. Click Maven installations.
    3. Add Maven.
    4. Uncheck Install automatically (do this if Maven is available in your system or else, check "Install automatically" and ignore the below steps).
    5. Provide Maven name.
    6. Provide Maven home directory path.

      Jenkins 
  • Configuring Git

    1. Go to Jenkins and navigate to Manage Jenkins -> Configure System.
    2. Click Git installations.
    3. Add Git.
    4. Uncheck "Install automatically" (do this if GIT is available in your system or else, check "Install automatically" and ignore the below steps).
    5. Provide Git name.
    6. Provide Git home directory path.

      Jenkins 

Step #4 Install Plugins required

  1. Go to Manage Jenkins -> Manage Plugins.
  2. Go to the Available tab.
  3. Search using a filter for Git Plugin, HTML Publisher Plugin.
  4. Check the box besides the plugins displayed after the search.
  5. Click on "Download now and install after restart" button.

    Jenkins

  6. Restart Jenkins.

Step #5 Creating new Job for running Serenity tests

  1. Click on "New Item" from the homepage.
  2. Enter the Job Name, and select Maven project.
  3. Click OK button.

    Jenkins
  4. Under the "Source Code Management" section, select Git and provide GIT URL. For instance -
    https://bitbucket.org/xxx/xxx.git

    Jenkins

  5. Click "Add" button and provide your username and password to access the Git Repository.

    Jenkins
  6. Under "Build" section, provide Root POM, Goals, and options.

    This is to specify which test to run.

    Ex - If HomeStoryTest has to be run, we should provide as below using –Dit.test switch.

    If all tests have to run, give as ‘clean verify’ (without any switch).

    Jenkins

  7. Under "Post-build Actions" section, select Publish HTML reportsfrom ‘Add post-build action’ dropdown.

    Jenkins
  8. Provide Index page path as below.

    Jenkins

  9. Click on "Apply and Save" button.

Step #6 Running a Test

From the Story page, click on "Build Now".

Jenkins

Step #7 View the Test Results

  1. We can view the console output while the test is running from the "Build Progress" section. Click on dropdown to go to the console output.

    Jenkins

    Jenkins


  2. Access HTML Reports from the "Job Dashboard" page.

    Jenkins

  3. Serenity Reports will be displayed as below.

    Jenkins