Postman Collection Runner : Load Testing, Functional Testing

By | January 8, 2024

APIs are everywhere which are a basic building block of different applications from small, medium to large enterprise scale. Testing of these APIs is always a crucial yet critical part. A large set of free, open-source as well as proprietary tools are available for API testing. One such popular tool is Postman. Postman is a graphical tool which can be used to test API collections locally or using its cloud version. Not just a typical API testing but also more sophisticated load testing and scheduled automated testing can also be made using Postman. In this tutorial, I will explain about Postman Functional Testing and Load Testing and will demonstrate how to Use Postman Collection Runner to execute tests on a set of APIs under a defined collection.

Read more: Postman Collection Runner : Load Testing, Functional Testing

Before we dig deeper and demonstrate API load testing in Postman, let’s first talk about the basics–What is API Load Testing?

An Overview of API Load Testing

APIs are implemented in any programming language or tool and then deployed into the servers on-premise, cloud or in a hybrid mode. In either case, APIs need to be resilient, stable & performance efficient. Load on these APIs can vary and grow significantly depending on the use-cases and potential clients using those APIs. To ensure that these APIs have been implemented using API best practices and subsequently deployed with the adequate software and hardware resources–load testing is performed.

Load testing is performed by exerting heavy load on the APIs to observe and analyze how the APIs behave under such heavy traffic. This helps to understand the expected performance of these APIs once real traffic starts flowing towards them. Not just load testing, Stress testing is also often performed to identify the breaking point–the level of load where APIs start to break and fail to serve the clients any further.

API Collection Testing Using Postman: How to Run Collection and Test All APIs Under a Collection using Postman Collection Runner

A Postman collection is a group of saved requests for the API calls. It can have API requests for any HTTP verb like POST, GET, PUT, DELETE etc. Creating a collection helps us to better arrange, manage and classify API requests. This also helps in testing these APIs collectively. To test all APIs under a collection together, we can use Postman Collection Runner.

In order to test APIs under a collection using Postman Collection Runner, perform following steps:

  • First create a collection and save multiple requests under the collection.
  • Now you can run this collection by clicking on the 3 dots (…) in front of collection name and click on Run collection.
postman collection runner run collection

Note: Alternatively, you can also run collection by clicking on Run button for your collection menu.

  • By default Run Manually option is selected where you will have to manually click on Run button to execute tests for your collection.
  • Now choose all those API requests which you want to run by checking/unchecking. You can also reorder these API requests depending on your need by dragging them up/down.
  • Under Run configuration, define how many iterations of the collection run you want and also define if you want to have any delay between multiple calls.
  • Under Advanced settings, you can also configure additional options (e.g. the test behavior in case of a failure).
  • Once you are done with all required configurations, you can click on the button with the name Run <<collection name>>.
  • All selected requests of the collection will run for the number of iterations configured. You should be able to see the results which states response code, response time as well as response size.
postman collection runner run results

Note: If there were any tests configured for individual API Requests, you will also see how many tests passed or failed. Otherwise, response code will only tell you the HTTP response status.

Postman Collection Runner: How to Run Automated Tests Using Schedule Runs Option

In the previous scenario, we used Run Manually option to run API collection tests with a manual trigger. Postman also provides option to schedule the testing. E.g. you can schedule a test to run every hour, every day or some other frequency. Note that you must be logged in to Postman as such scheduled tests execute on Postman Cloud.

In order to use postman collection runner for Schedule Runs, following steps are needed:

  • Ensure that you have a collection with at least one saved request.
  • Click on Run or Run collection and then choose Schedule runs to Periodically run collection at a specified time on the Postman Cloud.
  • Now you need to make necessary configurations for your schedule by giving it a name, specify Run frequency and other details like Email notification settings etc.
postman schedule runs automated testing
  • Once all necessary configurations are done, click on Schedule Run. Depending on your chosen frequency, your run will be scheduled and executed later accordingly. You can also opt for Run Now option to run it immediately once without waiting for the scheduled time.

How to Run Performance Test Using Postman: Postman Load Testing

So far in this tutorial, we learnt how to run functional testing. But Postman as a tool is also enriched with a feature to perform Performance Testing. This helps to understand how your APIs perform under load. Using this, you Simulate real-world traffic from your local machine and observe the performance of your APIs.

In order to perform Load Testing or Performance Testing, following steps are required:

  • Create a collection with at-least one saved request. Click on Run (or Run collection) for your collection.
  • Now choose Performance tab rather than Functinal tab.
  • Now setup your performance test. Define number of virtual users and total duration for the test.
  • You also need to define load profile: Whether you want to go with all virtual users from the start or you want a variable load with a defined ram up duration.
  • To simulate real world scenarios, you can also choose data files to assign unique data set to each virtual user.
  • Once all configurations are done click on Run button.
postman load testing

The performance test will execute based on your configurations and you should be able to see the results and understand how APIs performed for the given load. E.g. I have below performance results for a test executed for 25 virtual users for a total of 2 minutes with 1 minute ramp up period:

postman load testing results

Postman Load Testing and Collection Runner Video Tutorial

If you prefer to learn this topic in the video format, you can watch below video tutorial on TutorialsPedia YouTube channel which demonstrate the concepts with examples.

Ajmal Abbasi

Ajmal Hussain Abbasi is Integration Consultant By Profession with 13+ years experience in Integration domain mainly with TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Cloud, TIBCO Flogo, TIBCO Mashery, TIBCO Spotfire, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in various sectors by using his skills in TIBCO Flogo, TIBCO API Management (Mashery), TCI, Tibco Designer, TIBCO Business Studio, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi has experience with MuleSoft ESB as well. Ajmal Abbasi is also experienced in the area of API Management particularly with WSO2 API management platforms. Ajmal Abbasi is also experienced in developing solutions using Core Java and J2EE Technologies. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn - YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *