![]() |
Postman Collections are a powerful feature that enables users to organize and manage API testing and development. Collections consist of requests, which are APIs with a request and response format. In this article, we study the creation, utilization, and execution of Postman Collections with examples. Creating a Postman Collection1. Open PostmanLaunch the Postman application. 2. Create a New Collection
You can create a new blank collection like this: ![]() Creating a blank collection or Choose a template for the collection like this: ![]() Creating collection from the template Rest API Basics Here, we have selected Rest API Basics as the template, and what you see is a loader creating template in progress mode. This is how it looks like once the creation is completed. ![]() Collection created using Rest API Basics template It has by default all the four requests available for you to edit and duplicate to save time. 3. Add Requests to the Collection
![]() Adding a new request Remember to always name your APIs depending on the resource you are accessing, how you are accessing and what action you are going to perform. In the image show below, we are trying to fetch the user details by userId. So the route pattern is like
Every one have their own internal standards or rules behind naming the routes but this is something that is most widely used among the developers in general. Another way to create a request is by using Import button available on top. Copy the following lines of code and click on import button. Then you will be able to see a dialog that gets opened that says paste cURL. Paste the below code in that text box and wait: Javascript
This will create a new request and gives you the rename and save options, once this is successfully processed. 4. Repeat for Additional RequestsRepeat the process to add more requests to the collection if needed. Using a Postman Collection1. Access CollectionsIn the “Collections” tab, you’ll see a list of your collections. 2. View and Edit Requests
3. Organize and GroupOrganize requests within a collection using folders to structure your API tests logically. Here is the public collection available over postman website showing how to organize APIs by collection and folder level. This serves as a good example for organizing the requests in postman collection Running a Postman Collection1. Open Collection RunnerClick on the “Runner” tab in the left sidebar. 2. Select CollectionChoose the collection you want to run from the dropdown list. 3. Run CollectionClick the “Run” button to execute all requests in the collection. You can run all the tests in a folder and all the responses will be visible one by one ![]() Run all the APIs in the folder Then, a new view will be visible on the screen as shown below. Here you can choose to run manually or schedule runs at regular intervals. ![]() view showing the multiple options available to run the folder or collection altogether 4. View Results
![]() Postman Run folder results view This is how it looks after all the APIs in the folder has been run ConclusionPostman collections are powerful tools for maintaining and automating API testing and development workflows. By creating, using, and running collections, you can streamline your testing process, collaborate with team members. Regularly exploring new features and staying updated on Postman plans ensures optimal utilization of this versatile tool. |
Reffered: https://www.geeksforgeeks.org
Geeks Premier League |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |