How to Generate Newman Reports on Jenkins using Postman?


We can generate Newman reports on Jenkins. The reports obtained from Jenkins are a pictorial and organized representation of test execution results. These reports can also be shared with all the stakeholders of the project.

Jenkins reports can be generated in several formats and can be controlled by adding different flags in the build commands. Also, it is necessary to specify the path where the reports shall be saved in build commands.

The steps to generate Newman reports on Jenkins are listed below −

As a prerequisite, Jenkins should be configured in the system. The details available in the link − https://www.tutorialspoint.com/jenkins/index.htm. Also, we should have a Collection with a minimum one request along with the Newman installed in the system.

Step 1 − Click on the arrow to the right of the Collection name. Next, click the Share button.

Step 2 − SHARE COLLECTION1 window opens up. Move to the Get public link tab and copy the link that has been marked in the below image.

Step 3 − Open Jenkins and move to the Jenkins Job below the Build section. Add the below command to generate CLI and JUNIT reports −

newman run "<link copied in Step2> " --reporters cli, junit

Step 4 − To specify the path where the Newman report is to be saved, we should add the command.

newman run "<link in Step2>" --reporters cli,junit --reporter-junit-export
"report/newmanreport.xml"

Here, report/newmanreport.xml is the path where the report shall be saved. If that directory does not exist, the report gets created by default within the Jenkins Workspace directory.

Updated on: 03-Aug-2021

293 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements