API Automation using Newman
In last posts, we have learnt about How to setup Postman and how to use and store variables in Postman.
There is a command line tool available to execute the Postman collections with some awesome features like reporting etc. This tool is called as Newman.
What is Newman?
We can run collection in Postman similarly to run the collection via command line Newman is used. Newman allow you to run and test a collection via command line seamlessly and with minimal efforts. It also gets easily integrated with CI servers and build systems.
Installation
Easiest way to install Newman is using npm. Pre-condition is to have NPM installed.
$ npm install -g newman
-g - is used to install Newman gobally. You can just remove -g if you wish to install it locally.
The above command will install Newman and you'll be able to access it from anywhere.
Executing Collections via Newman
In order to execute a collection in Newman, we need to use the following command:
$ newman run {....}
One way to run the collection, is to have your collection exported into a json file and execute it via Newman.
$ newman run {path-to-jsonfile}
Another way is to execute via collection link. Postman allows to create a link of the collection which can be used to execute the same via Newman.
$ newman run {collection-link}
Newman also have ability to generate awesome reports post execution. In the next post we'll see how to generate reports via Newman.
No comments:
Post a Comment