We usually use the Postman to send requests to our APIs and get a response. All the requests that we send come under history so that we could re-use the requests. But this is a manual approach.
So the questions that rises are:
- Why use Postman collections?.
- Why would we need to automate them?
We will be going through the answer to the first question here. And will be covering the rest in the second part.
So the answer for the first one is: We can work with requests and history for a small set of requests, But once your history of requests scales up, finding a particular request in your history can become time-consuming.
And to handle this situation, we could use the Postman Collections.
What is a Postman Collection?
A Postman Collection lets us group individual requests together and we can organize these requests in folders.We can provide descriptions and logical names for these folders. We can create and publish API documentation pages.
We can automate these requests and we can add test scripts to requests and build integration test suites.
Step 1: Create a collection
Step 2: Provide documentation for the collection, if required.
Step 3: Click on the save button of the request and add the request to the particular collection.
Note: We can also save the responses as sample responses. This could help to reflect the expected responses.
Just click on the save response. And give some description-name.
So here it is, a basic scenario with postman collections. But we could do a lot more:
– We could import and export the collections.
– We could duplicate collections and customize them.
– And of course, there will be multiple requests, not a singular one, under one collection.
So, now we have created a postman collection. But it’s working on pre-defined values for the request. But there comes a scenario, when we have to use dynamic request parameters, we have to perform some modifications before and after the requests have been sent.
And we will be discussing those scenarios/requirements and the ways Postman provides to implement automation.
Till then keep going through our blogs. Because at Knoldus we believe in sharing knowledge.