We have already seen two basic posts about:-
In this post, we will see How to run a Collection in Postman.
You can relate a Postman Collection as a test suite for functional, regression or smoke. You may want to run all tests in a suite all together. Like we run a TestNG xml file containing Selenium tests. The same we can achieve in Postman using Collection Runner.
How to Run a Collection?
Import below collection in your postman to understand further examples well.
Above collection has four requests:-
- Generate access token.
- Create a new booking. Assert booking id is not null and setting it as environment variable to use in further APIs.
- Get all bookings and assert new booking id is listed.
- Get details of new booking id.
Click on “Arrow” or Expand icon at Collection name and click on “Run” button.
You will see a new Window will be opened with title as “Collection Runner”.
There are many fields which we will understand slowly in later posts. As of now, observe two fields:-
- Collection name – It should be same as collection name.
- Environment – Selected environment in Collection.
Leave the selected value as it is and click on “Run <Collection Name>” button.
You will see all APIs in selected collection are run in the order they appear in Collection and Run Result is generated.
Above Run Results shows:-
- All APIs/requests executed.
- It shows status, time and response size for each request.
- Tests of requests if exists otherwise it will show message as “This request does not have any tests.”
- Total number of tests passed and failed.
When you click on any request, it will show Request URL, Request Headers, Response Body and Response Headers:-
You can directly launch Collection Runner by clicking on Runner button at header:-
When we launch collection runner using above option, it will not select any collection by default as we have seen above. It will lists all collections and you need to select desired one.
More about API Testing in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.