I was setting up Newman in my CI/CD pipeline the other day, and I realized there is not an automatic way to run the latest version of your collection. The quickest way is to set up newman to use the url of the collection, and make sure you hit the “Update Link” button every time you make a change.
Since we all know people are forgetful and make mistakes, I did not think that was good enough. So I made a newman runner in npm called newman-pro that will use the postman api to get the latest version of your collection and run it for you.
You just need to feed it an integration api key, then you can run collections in a number of ways. You could pass it the name of a collection, or you could pass it the uid instead. You can even have it show the collections in your account and choose it from a list.
It’s still an early release right now, but I’d love some feedback and suggestions on how to improve it. Better yet, it’s an open source project, so if there is a feature you would like, by all means submit a pull request!
@allenheltondev excellent effort! TBH, this looks like an excellent feature that should make its way to newman.
As a side note, without any intention to hijack the thread: I wanted to point out that you can the Postman API with newman to get the latest version of your collection each time newman is run. So, your command looks like:
$ newman run https://api.getpostman.com/collections/{{collection_uid}}?apikey=xxxx
I was unaware you could pass the API key into the url for a collection or environment and get the latest version. That is a huge win
So the only feature that newman-pro would have that you couldn’t do normally would be to run collections and environments by name instead of url or json file.
newman-pro -c "Example Collection" -e "My Dev Environment"