API test automation allows you to run repeatable, reliable tests without manual effort. Tools like Postman support CLI-based execution and easy integration with CI/CD pipelines.
Postman collections can be exported and executed using a CLI runner. Automated tests validate response status, headers, body, and performance.
// Run a Postman collection using Newman CLI
newman run UserAPI.postman_collection.json
// Sample test script inside Postman
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
Newman prints test results, assertions passed/failed, execution time, and returns a non-zero exit code if tests fail.
Click the button to simulate a CLI API test run inside a CI pipeline: