Last Updated On
In this tutorial, we will generate a Newman HTML Report.
Table of Contents
What is Newman HTML Report?
A Newman HTML reporter that has been extended to include the separation of the iteration runs so these are no longer aggregated together and also some additional handlebars helpers
to enable users to create better custom templates
This reporter comes with a dashboard-style summary landing page and a set of different tabs that contain detailed request information. There are also a few optional configuration flags available, to tailor the final report in a number of different ways.
Prerequisite:
- NodeJS is installed
- Newman is installed
Implementation Steps
Step 1: Install newman-reporter-htmlextra package
Go to cmd prompt and type the below command:-
npm install -g newman-reporter-htmlextra
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-15.png?w=1046)
Step 2: Export the already created Postman tests
Export your Postman API collection as JSON file. To know how to export Collection in Postman, please refer to this tutorial – How to Export Postman Collections?.
![](https://qaautomation.expert/wp-content/uploads/2023/07/image-189.png?w=293)
This screen provides the option to export the JSON file as Collection v2 or Collection v2.1 and click on the “Export” button.
![](https://qaautomation.expert/wp-content/uploads/2023/07/image-190.png?w=434)
Open the Command Line and go to that location of the collection JSON file.
Step 3: Run the API collection through the command line
Use the below command to execute the tests and generate an HTML Report. The following command will create a new report in the ./newman directory, if the directory does not exist, it will be created as part of the Newman run.
newman run API_Newman_Tests.json -r htmlextra
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-17.png?w=833)
Go inside the newman folder and see a .html report is present.
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-18.png?w=1033)
Step 4: View Newman HTML Report
Double-click on the .html report and this will display. On the summary page, we get a summary of the test results we have run. We get detailed information like a number of iterations, assertions, skipped tests, and failed tests. From the Total Requests tab, we can get a lot of information like baseurl, the request body, the response header, and the response format. For more details, we can go to the Failed tests tab to check which scripts failed, the status code, and the assertion error message.
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-20.png?w=940)
Go to the Total Requests tab to get all the information regarding the request method used, request URL, request body, response body, time taken to process the request, the means size of the request, and so on.
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-21.png?w=965)
Go to the Failed Tests tab and see all the details about the failed tests.
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-22.png?w=1092)
Step 5: Additional CLI Options
Specify a path for the HTML Report.
Specify a path where the output HTML file will be written to disk.
Use the below command.
newman run API_Newman_Tests.json -r htmlextra --reporter-htmlextra-export ./results/report.html
![](https://qaautomation.expert/wp-content/uploads/2023/08/image-23.png?w=835)
If the path is not specified, the file will be written to the newmain/ in the current working directory.
That’s it! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!