API Automation using POSTMAN
API Automation using POSTMAN
AUTOMATION
USING
Postman Features:
REST, SOAP, and GraphQL support
JavaScript-based test scripting
Collection Runner for test automation
Environment and global variable handling
Integration with CI/CD tools via Newman
pm.response.to.have.header("Content-Type",
/application\/json/);
});
pm.test("User ID is present", function () {
Advantages:
Batch execution
Useful for smoke and regression testing
Combine with data files for parameterized testing
Chapter 6: Environment and Variable
Management in Postman
Using Variables:
{{baseUrl}}/api/users
Best Practices:
Store tokens, base URLs, and dynamic values
Use pre-request scripts to update variables
Chapter 7: Integrating Postman with
CI/CD Pipelines
Installing Newman:
npm install -g newman
Basic Command:
newman run collection.json -e environment.json
Use Cases:
Automate tests in Jenkins, GitHub Actions, or Azure
DevOps
Get test summaries in CI pipeline logs
Chapter 8: Real-world Project
Examples
Pitfalls to Avoid:
Hardcoding values in tests
Ignoring negative scenarios
Not handling authentication tokens dynamically
Best Practices:
Modularize requests into folders
Use descriptive test names
Store reusable code in variables/scripts
Document each endpoint
Chapter 10: Final Thoughts and Career
Advice