Run Postman collections from the terminal with Newman and Make
You can run your Postman collections outside of the Postman app using Newman, Postman’s CLI runner.
First, install Newman:
npm install -g newman
Export your collection from Postman as a JSON file and place it in your repository. Then run it:
newman run collection.json
If your collection uses an environment, pass it with the --environment flag:
newman run collection.json --environment environment.json
To make it easy to run from any repo without remembering the command, add a target to your Makefile:
smoke-test:
newman run postman/collection.json --environment postman/environment.json
Then just run:
make smoke-test
This is useful for running smoke tests on CI or after a deploy, without needing the Postman app installed.