Transcript lesson4-coverimage.png

Overview: For the final part of our Postman test automation journey, we're going to take a look at Newman, which is a tool that will allow you to run Postman test collections on the command line, which means they could be integrated with Jenkins or with other continuous integration solutions


For maximum benefit, please view the course video for dynamic demonstrations.

Newmanis easy to install as long as you have Node.js installed on your machine. If you didn't install it before to run Restful Booker locally, you'll need to install it now in order to use Newman.

Once you have Node installed, you install Newman by running npm install -g newman—the “dash G” means you can run it from anywhere. And it will do its installation thing, and here we go. We can tell it's installed by checking the version (newman --version), and there we go, in this case it’s 3.1.

Now that we have Newman installed, the next step is to save our collections, so that we can run them on the command line. So we come here to our collection, and we're going to export. And to resources, I like to remove spaces here. It will automatically use the name of your collection into the file name. Then we save that.

We also want to save our environments. So in order to do that we go to the gear icon in the top right corner, and whichever environment you want to run in, you just download that, and we'll save it.

Okay, let’s see what we can do.

Now that we've saved our Postman information, I've opened up a command line shell in the folder where they were saved, as you can see and we're going to run Newman. The basic command line is “newman run,” and then the name of our EVT file, and then -e for environment and the name of our environment file.

newman run RestfulBookerBVT.postman_collection.json -e Local.postman.environment.json

So it finished running, and it gives us a basic report of how many scripts ran and how many assertions there were and how many failed, and it breaks down all the failures. So that is pretty great for just running on the command line. But even better, is when you run it in a continuous environment tool such as Jenkins.


So here we are in my local instance of Jenkins.


One thing to note is that you need to have the Node.JS module installed in Jenkins, the plugin for Node.JS. So that is a requirement. It didn't use to be but now it is.

We have our job and let's just take a look at what it looks like. This is a very simple one, we have our Node.js installation and just using the system defaults here, and I have Newman run again, then the full path to the BVT collection. The environment, in my environment file. And then this is part is different, we have two different reporters, we're reporting to the command line and junit style. And then we're going to export that as an XML file. So this reporter, junit , and then the export is so that Jenkins will be able to display the results. Then afterwards, we publish the test result which is result.xml and that is our job.

newman run RestfulBookerBVT.postman_collection.json -e Local.postman_environment.json --reporters cli,junit --reporter-junit-export result.xml

So let's run it, see what happens. Should run pretty quickly. And it's already done. So we have test result, we know that there's failures and we can go and we can dig into the test results here, right, we see that our expected check in times are wrong.

That’s how you can run your Postman collections in Jenkins. You start with the tool where you're exploring the API, discovering the things that it can do. Thinking about how this API is working in your entire product chain, and after you have familiarized yourself with it, you can start to create a set of automation tests that test the functionality if it's super important and when you have your tests, you can put them into your continuous integration environment, so that it's part of your entire build process.

So I hope you've enjoyed this course on exploring API's through test automation with Postman.


Some additional resources, or some reminders of resources we discussed. We have Restful Booker.

Restful Booker -

The Postman Sandbox API reference, and the [Postman] ( in general has tons of documentation, videos, instructions, all that sort of thing.

Postman Sandbox API -

I would definitely recommend Danny Dainton's GitHub account. He has a lot of interesting tools to format your Newman reports or more examples of interesting ways you can use Postman to do tests, so definitely check that out as well.

Danny Dainton's Postman Resources -

###Thank you again for spending this time with me, and thanks to Test Automation University and Applitools for hosting me.

If you have any questions you can contact me through Twitter @ambertests or you can email me at

And happy testing!!

# Code Resource

Source Code

© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR