In the last tutorial we learnt about the basics of automated testing and got familiar with Newman. Newman, which reminds me of a famous character Newman from Seinfeld (a 80s American Show) is a command line integration tool delivered by Postman. In this tutorial we will try to install Newman in our system.
In the last tutorial, we also discussed that Newman works on Node.js completely, so it must have hit you that we will definitely require it in our system. Yes, that is correct. Newman installation requires two things:
- NPM (Node package manager)
But before starting the installation we will see what is NPM in the below section.
What is NPM?
Although too much knowledge about NPM is not necessary for us but there is much more to NPM than packages and registry. If you are interested in the same, you can visit their website here. We will try to install Newman now and as we discussed above, Newman requires node.js and NPM. So first we will try to install both of these things by following the steps.
How to install Node.js
As mentioned earlier, we already have a tutorial for you to install the node.js on our website. But before visiting the page, you must be sure that you don’t have node.js previously installed.
1. Open your Command Prompt (Terminal for Mac)
2. Type the following
node -v (for windows)
node –version (for mac)
3. If you see a version number then you have node.js previously installed and do not need anything else to do.
4. If you see any error or anything else than the version number, then you must install node.js by visiting this page.
Also, if you have followed the steps that were given for the installation of node js on our website, you must have also got NPM installed in your system.
How to install Node Package Manager
1. Open your command prompt (terminal for mac)
2.Type the following in your command prompt
npm -v in windows
npm –version in linux/mac
You can also go through this link for download and learning about npm
3.If you see a version number as you press enter, then you already have npm installed and you can proceed further for installing Newman.
If you do not see a version then you might need to install it again from the tutorial on our website and check again.
Since now we have both the prerequisites installed, we will now proceed to install Newman on our system.
How to Install Newman using NPM?
For installing Newman in your system, follow these steps.
1.Open the command prompt (Terminal for mac)
2. Type npm install -g newman
NOTE: The command is same for Mac.
3. This will install a new dependency through NPM. You will see the following screen after pressing enter (if npm is successfully fetched and installed).
4. It will take a few minutes to install Newman. Once installed you will be indicated with the following line.
added 196 packages in 187.889s (Time may vary).
For confirmation, you can also check the version of Newman.
5. Type the following in your command prompt (Terminal if Mac)
newman -v (Windows)
newman –version (Mac)
6. If you see the version number after pressing enter, you have successfully installed Newma or else, it has failed and you must try again.
So by following these steps, we have installed Newman successfully on our system. We will proceed now for the next tutorial to start using Newman with Postman.