How to Create Elegant HTML Reports in Postman

by Ezequiel Dellavechia

4 min read

Are you wondering what is the best way to create elegant HTML reports in Postman? Wonder no more because I have the answer in the blog post below!

Postman can be a powerful tool when it comes to testing. Every time we introduce a new code, we have to create a new test to ensure that our API is working properly. 

In Postman, you can add Tests to verify the results of the response and verify them in the Test Results tab.

But what if we want to create an effective HTML report that shows those results? 

In this Postman to HTML tutorial, I will give clear instructions on how to create elegant HTML reports in Postman, quickly and easily. 

Let's dive in!

Why We Should Generate HTML Reports

Knowing how to generate HTML report in Postman is vital since HTML reports are a great way to show to the rest of the team the results of our current test execution. 

They are clear and they contain results written in a way that everybody who accesses the file can see the information clearly. 

Also, a Postman HTML report looks more professional. There's no comparison between a word document and an HTML!

Installing NodeJS and npm

The first step in creating reports in Postman is to install NodeJS. 

This step is simple. 

We can download NodeJS from the official site (https://nodejs.org/). Just make sure to install the version that matches your OS. 

During the installation setup, confirm that the npm package manager is selected as we will be using this package in the next step. Let's move on to the next Postman reporting step.

Checking the Success of the Installation

We can check that NodeJS and npm were successfully installed by opening cmd and typing:

node-v

NodeJS version should come up.

npm -v

Npm version should come up.

Installing Newman and HTML Reporters

Newman is the collection runner in Postman that allows us to run and test a Postman Collection from the command line. Installing it is pretty simple. 

Use cmd once again and type:

npm install -g newman

Once Newman installation is completed we can install the reporters by typing:

npm install -g newman-reporter-html
npm install -g newman-reporter-htmlextra

Finally, after this Newman HTML report command, we are ready to create the HTML reports!

Creating Elegant Postman HTML Reports

Exporting Postman’s Collections and Environments

We have completed the reporters installation, but we still need the export Postman collection that we want to execute and translate to our HTML reports. 

But how to export Postman collection?

This can be done using Postman by just selecting Export in the collection folder and then saving them as a *json file. 

We also have to export the environment and save it as a *json file.

Running Our JSON Files

This is our last step in creating the HTML reports. 

First, we need to open the cmd and access the folder where we saved our Postman JSON to HTML files (for example, cd C:\Users\YourName\ExportedJSONs). 

Once we access this folder, we can execute the files inside it by using this command:

newman run YourCollectionName.json -e YourEnvironment.json -n 2 -r htmlextra

Please note that you will have to replace YourCollectionName and YourEnvironment with the name of your exported files. 

Keep in mind that -n 2 refers to the number of iterations you want. For example, you can try -n 5 if you want 5 iterations. This will be shown in your HTML dashboard.

Once we execute the command, a folder called Newman will be created in our collections folder origin. Open it by using your favorite web browser and you will find your Postman export test results to HTML in an elegant HTML file.

To Sum Up

Congrats! You have successfully managed to create elegant HTML reports in Postman.

I hope this tutorial helped you and I wish you good luck with your testing!

You can find additional information about the HTML reporter in:

https://www.npmjs.com/package/newman#html-reporter

And if you need to hire QA engineers, get in touch with us today.

FAQs

Q: How do you generate a Postman report?
We can generate postman reports by running our json collections using Newman reporter. Postman report generation enables data visualization of your team's usage of Postman.
Q: How do I run a Postman collection with Newman?
After installing Newman and the HTML reporter. We can run our collections using the command line specifying the collection name, iterations and environment.
Q: How do you create a report in HTML?
HTML reports are created after we have installed the HTML reporter in Newman. We can also install the reporter htmlextra, for more customization.
Q: What is Newman Postman?
Newman Postman is a command line that allows the user to run a collection from the command line.
Q: Is the Postman tool open source?
Postman is totally free although you can purchase Team, Business and Enterprise versions that have some features that the free version doesn't.
Ezequiel Dellavechia
Ezequiel Dellavechia
QA Engineer

Ezequiel is a QA Engineer with over 10 years of experience. He's been working on different projects with distinct clients and companies using numerous types of technologies and platforms. He really enjoys working with automation frameworks, but he's also a fan of manual testing. As a person, he's constantly interested in learning new tools that can help him at work and willing to be a mentor to other team members. When he's not working, you'll find him playing video games, spending time with his dog, ​​or visiting new places.

Expertise
  • Automation
  • Jira
  • QA
  • Python
  • Agile Methodologies
  • +9

Ready to start?

Get in touch or schedule a call.