In the previous tutorial, we have seen the Integration Of Jenkins With Selenium WebDriver. In this tutorial, we show you how to execute Serenity tests in Jenkins.
Pre-Requisite:
Jenkins installed and started on the computer
To generate Serenity Report in Jenkins, we need to download HTML Publisher. Please refer to this tutorial to install the plugin – How to install Plugins in Jenkins
Implementation Steps
Step 1: Create a new project using the Maven project plugin.
- Give the Name of the project.
- Click on the Maven project.
- Click on the OK button.
In the General section, enter the project description in the Description box.

Step 2: Build Management
Go to the Build section of the new job.
- In the Root POM textbox, enter the full path to pom.xml
- In the Goals and options section, enter “clean test“

Click on the Advanced button.
Step 3: Select custom workspace
Mention the full path of the project in the directory.

Step 3: Select “Publish HTML Reports” from “Post Build Actions“
Select “Publish HTML reports“.

- HTML directory to archive – target/site/serenity
- Index page[s] – Index.html
- Report title – HTML Report

Click on the Apply and Save buttons.
We have created a new Maven project “SerenityDemo” with the configuration to run the Serenity Tests and also to generate a Serenity Report after execution using Jenkins.
Step 4: Execute the tests
Let’s execute it now by clicking on the “Build Now” button.

Right-click on Build Number (here in my case it is #5) and click on Console Output to see the result.

Below is the execution summary of the tests.

We can see below that the Serenity Reports are generated.

Once the execution is completed, click on “Back to Project“.

We could see a link to view ‘HTML Reports’. Click on the HTML Reports. It displays the Index.html Report of Serenity.

Serenity Report is in HTML format. So, we need to install HTML Publisher Plugin to view the Serenity Reports. Please refer to this tutorial to download and install the HTML Plugin in Jenkins – How to generate HTML Reports in Jenkins.
The Serenity Report looks like as shown below:

How to find the path of reports in Jenkins?
After running successfully, go to the job and click on the “Workspace” link. As soon as we click on the above-mentioned link, we will be inside this directory. Now click on the “target” link.

As soon as we click on the above-mentioned link, we will be inside this directory. Now click on the “site/serenity” link.

As soon as we click on the above-mentioned link, we will be inside this directory. Now we can see all the reports of Serenity.

This way, we could run Serenity tests and generate Serenity Reports using Jenkins.
Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!