Postman Collections enables developers to group individual requests together and organize them into folders. According to the company, creating collections helps teams stay organized, up-to-date, provides the ability to attach test scripts to requests and build integration tests suites, and pass data between API requests and build workflows.
“Maybe you’re a QA engineer who wants to occasionally run your Postman tests from the command line. Maybe you’re a DevOps engineer who wants to integrate Postman tests with your CI/CD build process,” the company wrote in a blog post. “The Newman CLI can help you run and test your collection ONCE or EVERY time you make changes.”
According to the company, the tool can run with a local JSON file in an ad hoc manner, run with the latest collection URL and integrate with a CI/CD pipeline. The tool supports a variety of output formats as well as outputting to JSON or HTML files.
Running Newman with the latest collection URL is a good option for developers who are collaborating with a team or making updates to the collection, the company explained. “Instead of manually exporting another collection file every time someone makes an update, use the Postman API to retrieve the latest version of the collection to save time and be rest assured that you’re working off the correct version. You can do the same to retrieve the latest version of an environment, if you’re using one,” the company wrote.
In addition, developers can run Postman tests every time their build process kicks off, and integrate it with their CI service such as Jenkins, Travis CI or any other code deployment pipeline tool, Postman said. “You will set up your CI configuration to run a shell command upon kicking off your build. The command is a Newman script that runs your collection with the tests, returning a pass or fail exit code that’s logged in your CI system,” Postman wrote.