How to generate automated test reports using Postman ?
Last Updated :
24 Jul, 2024
Postman is the API testing tool that helps to simplify the process of developing and testing APIs (Application Programming Interface). In this article, we will explore how to not only create environments but also generate automated test reports, enhancing efficiency and reliability in the API testing workflow.
Prerequisites:
Steps to generate automated test reports using Postman :
Step 1: Open the terminal and run the below commands to download dependencies globally.
npm install -g newman
npm install -g newman-reporter-htmlextra
Step 2: Open Postman and click on the "Collections" tab. Click "New Collection" and give it a name. Add requests to your collection by clicking "Add Request."

Step 3: Open a request in your collection and write the sample API. Click on the "Tests" tab to write your test scripts using JavaScript. Write assertions to verify the response.
API used: https://postman-echo.com/get
Example Test Script:
JavaScript
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
pm.test("Response time is less than 200ms", function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});

Step 4: Click on "Runner" in the top menu. Select the collection you created. Click "Run" to execute the collection, and observe the results in the "Runner" tab. You can drag your collection and move it to the run order panel.

Step 5: After dropping the collection to the runner, you can see the result of tests. Now to view the detailed HTML report, Click on three dots besides the "New Collection" tab and click on export and save the collection.

Step 6: Create Newman: Now run the following command in cmd to generate the test report.
newman run <Your-collection-path> -r htmlextra --reporter-htmlextra-title "Automated test reporting - Postman echo"

Step 7: Generate HTML Report: Look for Newman in the directory you wrote this command.You will see a chrome link there , View and download report.

Output:
Similar Reads
How To Generate Reports Using Postman Tool ? Postman is a widely used tool for API testing. It offers a user-friendly interface for sending various HTTP requests (GET, POST, PUT, DELETE). One of the best things that we can do in Postman is Generate reports effectively. In this article, we will explore the various approaches to generating repor
3 min read
How to write automated tests for APIs using Postman Postman is an API (Application Programming Interface) development tool that helps developers test and manage API responses while developing or modifying an API. Along with a dynamic user interface and manual testing features, postman also comes up with a feature of writing automated tests to verify
5 min read
How to generate API documentation using Postman? Postman is a popular API testing tool that is used to simplify the process of developing and testing APIs (Application Programming Interface). API acts as a bridge between two software applications which enables them to communicate and share data. In this article, you will learn how to generate API
2 min read
How to test an API using Postman ? API testing is a software testing type that tends to validate the application programming interfaces. As per Postman API, API testing is confirming that an API is working as expected. It sends requests to an API and monitors the responses to check its behavior to assess the functionality, reliabilit
5 min read
How to create mock servers using Postman Postman is a comprehensive API platform used by developers; this platform provides a set of tools that support API design, testing, documentation, mocking, and API Monitoring. It also simplifies each step of the API lifecycle and streamlines collaboration, enabling developers to create and use APIs
7 min read