Open In App

How To Generate Reports Using Postman Tool ?

Last Updated : 05 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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 reports using the Postman Tool.

Prerequisites

Approach 1: Built-in Method.

Step 1: Select the existing collection to generate the report of that collection.

Step 2: Write Tests for Your Requests:

For each request in your collection, write tests to validate the response. This is done in the “Tests” tab of each request.

Sample test script:

pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
wdefgtrhj

Test Scripts

Step 3: Now click on the Runs tab and then click the Run collection button.

Group-5

Step 4: After that we can set some options for the collection Runner, these are the following properties that we can set, Optionally, select an environment, adjust iterations, delay, and other settings as needed. in this case we will choose the defalut setting. After that click on the Run Collection in this case Run GeeksforGeeks that we named our collection.

Group-6

Step 5: After that it will show the final results about the tests, we can see in the image below.

Screenshot-2023-12-27-100103

Step 6 :Now we can also export this result and save the report as a JSON file. To do that click on the export Results button and save the file on the your preferred location.

Group-4

Final Output:
5f40463c-3eb5-4427-b9d4-8db8159d0c85

Approach 2: Using Newman for Enhanced Reporting:

Step 1: Install the Newman HTML Reporter using the following command. By using the following command the newman will be installed globally

$ npm install -g newman

Step 2: Now to create the report using the Newman HTML Reporter, we have to export the colletion, since it will need the location of the collection. So export the collection as showin in the image below.

Group-7

Step 3: Run the following command to generate the report using the newman.

newman run “<location of the colletion>” –reporters html –reporter-html-export “<location where you want to export the report>”

In the given command there are two paths will be required, the first path will be the location of the colletion that you saved and the next path will be that where do you want to export the report. Note that it will generate the report as html file.

Step 4: After successfully executing that command a html file will be generated which is the actual report of that colletion that we tested using the newman. Here is the image below of that report.

repport

Final Output:

4e40a81b-ae22-4276-a735-76f4eb38993a



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads