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 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
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, HTML reports look 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.
Checking the Success of the Installation
We can check that NodeJS and npm were successfully installed by opening cmd and typing:
NodeJS version should come up.
Npm version should come up.
Installing Newman and HTML Reporters
Newman is the collection runner 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, we are ready to create the HTML reports!
Exporting Postman’s Collections and Environments
We have completed the reporters installation, but we still need the collections that we want to execute and translate to our HTML reports.
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 JSON 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 test results 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:
And if you need to hire QA engineers, get in touch with us today.