A Beginners Guide to Postman Features and Automation Scripts
What is Postman?
Postman is a great tool when trying to dissect RESTful APIs made by others or test ones you have made yourself. It offers a sleek user interface with which to make HTML requests, without the hassle of writing a bunch of code just to test an API’s functionality. Postman’s features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.
Advantages of postman!
1. Postman can be used as an API Client to quickly and easily send REST, SOAP and GraphQL requests directly.
2. We can automate manual tests and integrate them into your CI/CD pipeline to ensure that any code changes won’t break the API in production.
3. Mock an API by simulating endpoints and their responses without having to set up a backend server.
4. Generate and publish beautiful, machine-readable documentation to make your API easier to consume.
5. Stay up-to-date on the health of your API by checking performance and response times at scheduled intervals.
Automated Testing using Postman
2. It also has the feature of Pre-request scripts to add any data or test case before the API hit.
3. We can define Environmental/Global/Collection specific variables in postman to help with automation.
4. Postman supports Chai assertions library. It provides functions and methods that help you compare the output of a certain test with its expected value.
5. Postman supports schema validation with the help of Tiny Validator.
6. A particular flow of tests can be run together with the help of Postman collection runner.
Designing and Mocking API
1. An example can be designed and mocked.
2. Example is the term used for a sandbox API in postman.
3. Once it is mocked, postman creates a mock server URL to be used for hitting the API defined in the example.
Monitoring using Postman!
1. We can monitor the APIs for uptime, responsiveness, and correctness.
2. We can define a monitor for an API collection along with monitor run frequency.
3. Receive mail notifications for run failures and errors.
4. Add delays, request timeouts and retry mechanisms for the monitor.
API Documentation using Postman