In this tutorial, we show you how to generate JUnit Report Using Jenkins.
Pre-Requisite:
Jenkins installed and started on the computer
To generate JUnit Report, please refer to this tutorial to get the code – How to generate JUnit4 Report.
To generate JUnit Report in Jenkins, we need to download JUnit Plugin. Please refer to this tutorial to install the plugin – How to install Plugins in Jenkins
Implementation Steps
Step 1: Start the Jenkins server and open the browser and navigate to
Step 2: Create a new FreeStyle project.
- Give the Name of the project – JUnitReport_Demo
- Click on the Freestyle project.
- Click on the OK

In the General section, enter the project description in the Description box.
Select a custom workspace and provide the full path of the project.


Select Source Code Management as None if the project is locally present on the machine

Step 3: Build Steps
In the Build Steps section, select Invoke top-level Maven targets.

The Build Steps window will extend. Mention the below details:-
Maven Version – MAVEN_HOME
Goals – clean test

Click on the Advanced button.
Step 4: Provide the full path to pom.xml
Specify the full path to pom.xml in POM.

Step 5: Select “Publish JUnit test result report” from “Post Build Actions“
Scroll down to “Post Build Actions” and click on the “Add Post Build Actions“drop-down list. Select “Publish JUnit test result report“.

Enter the Result Path as “**/target/surefire-reports/*.xml”.

Click on the Apply and Save buttons.
We have created a new Maven project “JUnitReport_Demo” with the configuration to run the Selenium with JUnit Tests and also to generate JUnit Report after execution using Jenkins.

Step 6: 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 #2).

Click on Console Output to see the result.

Step 7: View the JUnit Report
Once the execution is completed, we could see a link to view the “Test Report“.

Below is the summary of the Test Execution.

This way, we could generate JUnit Report using Jenkins.
Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!
Additional Tutorials