Who Says We Need Postman?
The name ‘Postman’ may conjure images of bygone days involving large shipping vessels, cumbersome USPS vehicles and draw bridges. Today’s bridges stretch ever higher towards the clouds and so does the Postman I am referencing. A developer API Tool, Postman is rich in features that allows the modern-day programmer to improve his efficiency and quality through an intuitive flexible UI while improving confidence in the tested code being deployed.
There is a wealth of knowledge available on line at (https://www.getpostman.com ) or from the Postman-client, about its capabilities and how these can help you in your daily API development activities. Novice or expert, there is something for everyone.
Can Postman Deliver
Here is a brief summary of features that could help you:
- News Letters and Blogs.
- API Documentation with detailed API examples.
- Downloadable Postman Collections (PM Echo and Echo-MOCK).
- Online Training.
- Community Sharing.
- Personal collections.
- Company shared collections.
- Environment customization.
- Mock Servers.
- Monitoring of Automated API’s, with Notifications.
- Export of Collections and Reports.
If you like Conferences, then Post-Con maybe just what you’ve been waiting for.
So, what will you have?
- The client provides URI’s to online and embedded resources.
- Basics: Collections, folders, tests, pre-scripts.
- Templates to get you moving quickly.
- API for existing services (eg . Twitter ADS API).
- Automated tests with variable data sets per iteration if desired.
- Programmatic variables for environment, global, collections and individual tests.
- Variable substitution within the ‘requestBody’ at runtime.
- Dedicated console for viewing logs/tests etc.
- Automates single or multiple tests.
- Exporting Environment setup, collections, Tests and Test Results in ‘json’ format to hare or use with other tools eg. Newman.
- Unit: individual modules, functions, classes in isolation from the rest of the code.
- Integration: Application to applications, or Application to External systems.
- E2E: Custom built Application executions, typically provisioning of services
Setup is minimal, just a few clicks and you’re there with a plethora of documentation.
Testing developed code and (UC)
- Develop Test(s) for each Use Case (UC) of ‘service’.
- Include Create, Update and Deletion Transactions for each UC.
- Use the targeted Application REST API ( POST, PUT, PATCH, DELETE etc.).
- Build the required Payloads for the API calls.
- Accommodate variable substitution within the XML/JSON Payloads.
- Automate the Test Execution.
- Include Reporting of Test Results.
- Switch between PM environments to target current work effort/collection.
- Team contributions can expand collection content rapidly.
- Leverage from ‘current/other teams’ previous efforts.
- Targeted testing for code additions/enhancements.
- Progressively increase quantity of tests available for ‘regression’ testing.
- Automation of tests saves time.
- Shared collections keep everyone in-sync.
Tips for writing Tests
- Organize your test scenarios by grouping your requests in collections and folders, and naming them descriptively.
- Document your API’s requirements using markdown in the descriptions.
- Use variablesto simulate more sophisticated user flows.
- Common tests that will be run after every request can be added to collection-level tests or folder-level tests.
If you’re not already familiar with writing tests in Postman, check out these resources.
- Postman docs: Test scripts.
- Postman docs: Test examples.
- Community contribution: Quick reference guide.
- Community contribution: Examples and guides.
- Postman blog: Writing tests in Postman.
- Postman blog: API testing tips from a Postman professional.
Practical example using: Authentication API
Itential Deployment: Save the responseBody which is the ‘token’:
Token re-use: (JobQuery):
ParkMyCloud: Parse the responseBody (json) for the ‘token’ property: