Article Directory
overview
- Newman: A tool developed based on nodejs that can run Postman scripts and generate test reports.
- This article introduces the whole process of Newman installation, including the following three steps: 1. Nodejs installation and environment configuration.
2. Install newman.
3. Install newman-reporter-html. - In addition, there are some problems and solutions encountered during the installation process.
Newman installation in three steps
1. Nodejs installation and environment configuration
1. Installation
(1) Steps
Download address: http://nodejs.cn/download/
After the download is complete, double-click to run the installation package, such as [nnode-v18.17.0-x64.msi]
and click Next to complete the installation process.
(2) Test
Open the cmd window and run node -v
, the result is shown in the figure below:
2. Environment configuration
(1) Configure the storage path of the global module of npm and the path of the cache
Create new node_cache and node_global empty folders in the Nodejs installation directory, as follows:
(2) Open the cmd window and run the following two commands respectively
Note: Change the path to the location of the above two folders you created yourself.
npm config set prefix "D:\Nodejs\node_global"
npm config set cache "D:\Nodejs\node_cache"
(3) Right-click on this computer → Properties → Advanced System Settings → Environment Variables
Add the system variable NODE_PATH to the path of the node_modules folder, such as: D:\Nodejs\node_modules
edit the system variable Path to add %NODE_PATH%
and edit the npm path in the user variable Path, and change it to the node_global folder path, such as:D:\Nodejs\node_global
2. Install newman
1. Steps
Open the cmd window, run npm install -g newman
the input newman -v
, if the version number appears, the installation is successful
2. Problems and solutions
(1) "npm notice Run npm install -g [email protected] to update!" appears during installation,
as shown in the figure below:
Solution: Enter npm install -g npm
and install the latest version of npm.
** (2) After the installation is complete, the input newman -v
shows "'newman' is not an internal or external command, nor is it an operable program or batch file." As
shown in the figure below:
Solution: Configure the nodejs environment according to this article 1.
3. Install newman-reporter-html
Open a cmd window and runnpm install -g newman-reporter-html
This completes the installation and configuration of Newman.