[Postman] Newman installation and environment configuration full version (including problems and solutions encountered during the installation process)

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/
insert image description here
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:
insert image description here

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:
insert image description here

(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"

insert image description here
(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
insert image description here
edit the system variable Path to add %NODE_PATH%
insert image description here
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
insert image description here

2. Install newman

1. Steps

Open the cmd window, run npm install -g newman
insert image description here
the input newman -v, if the version number appears, the installation is successful
insert image description here

2. Problems and solutions

(1) "npm notice Run npm install -g [email protected] to update!" appears during installation,
as shown in the figure below:
insert image description here
Solution: Enter npm install -g npmand install the latest version of npm.
insert image description here
** (2) After the installation is complete, the input newman -vshows "'newman' is not an internal or external command, nor is it an operable program or batch file." As
shown in the figure below:
insert image description here
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
insert image description here

This completes the installation and configuration of Newman.

Guess you like

Origin blog.csdn.net/jylsrnzb/article/details/131947937