As a tester, an essential part of your process is how to generate your API test report.
In this blog post, I will be going through the basic steps of how I generate a custom newman HTML report for my API automated test on Postman.
The First step is exporting your postman collection and environment.
- On your postman workspace, click on the three dots beside your postman collection.
- Click on the export option
- Export the collection as a json file
- You'll also need to export your postman environment file just as you exported the collection json file above.
- Create a folder on your local computer and save the exported json files inside it.
Second step is installing newman and newman reporter
Download node js on your computer here
Install npm using
npm i newman
- Install newman HTML reporter by using
npm i newman-reporter-htmlextra
Verify you have installed each package successfully by running the following commands
- Node js -
node --v
- npm -
npm --version
You should get a response like this
Now let us generate a custom HTML newman report for our test
Open your command line or Terminal
CD into the folder you have your postman collection and env file.
Run command
newman run {{postmancollection.json}} -e {{postmanenvironment.json}} -r htmlextra
An example
newman run Xend.postman_collection.json -e ktest.postman_environment.json -r htmlextra
- Go back into your folder you will see a new folder named "newman", inside the folder is where your reports are stored. Here is a sample image of how the HTML report looks like
I have just shown you how to generate a custom template for your API test report.
Also, note that we have different HTML report templates and it depends on the format you desire.
Don't forget to like and follow my blog if you find this useful and also drop your comments ๐