概要
- Newman:一款基于nodejs開發(fā)的可以運行Postman腳本的工具,并且可以生成測試報告。
- 本文介紹了Newman安裝全過程,包括以下三個步驟: 1、nodejs的安裝與環(huán)境配置。
2、安裝newman。
3、安裝newman-reporter-html。 - 另外還有安裝過程中遇到的一些問題與解決方案。
Newman安裝三步走
一、nodejs安裝與環(huán)境配置
1、安裝
(1)步驟
下載地址: http://nodejs.cn/download/
下載完成后雙擊運行安裝包,如【nnode-v18.17.0-x64.msi】
點擊下一步完成安裝過程。
(2)測試
打開cmd窗口運行node -v
,結果如下圖所示:
2、環(huán)境配置
(1)配置npm的全局模塊的存放路徑以及cache的路徑
在Nodejs安裝目錄下新建node_cache和node_global空文件夾,如下:
(2)打開cmd 窗口分別運行以下兩條命令
注意:將路徑改為你自己新建的以上兩個文件夾的位置。
npm config set prefix "D:\Nodejs\node_global"
npm config set cache "D:\Nodejs\node_cache"
(3)右鍵此電腦→屬性→高級系統(tǒng)設置→環(huán)境變量
添加系統(tǒng)變量NODE_PATH值為node_modules文件夾的路徑,如:D:\Nodejs\node_modules
編輯系統(tǒng)變量Path添加%NODE_PATH%
編輯用戶變量Path中的npm路徑,將其改為node_global文件夾的路徑,如:D:\Nodejs\node_global
二、安裝newman
1、步驟
打開cmd窗口,運行npm install -g newman
輸入newman -v
,出現版本號即為安裝成功
2、問題與解決方案
(1)安裝時出現"npm notice Run npm install -g npm@9.8.1 to update!"
如下圖所示:
解決方案:不用管,后面安裝newman-reporter-html還需要降低版本。
(2)安裝完后輸入newman -v
顯示“‘newman’ 不是內部或外部命令,也不是可運行的程序或批處理文件?!?/strong>
如下圖所示:
解決方案:按照本文一中進行nodejs的環(huán)境配置。
三、安裝newman-reporter-html
1、步驟
降低npm版本,運行命令:npm install npm@6.14.10 -g --no-fund
運行npm install -g newman-reporter-html --no-fund
至此完成Newman的安裝與配置。
2、問題與解決方案
(1)問題:npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
如下圖所示:
解決方案:參考步驟(1),降低npm版本,運行命令:npm install npm@6.14.10 -g --no-fund
文章來源:http://www.zghlxwxcb.cn/news/detail-716867.html
(2)問題:輸入npm install xx
后出現:
3 packages are looking for funding
run npm fund
for details
解決方案:在后面加上 --no-fund
文章來源地址http://www.zghlxwxcb.cn/news/detail-716867.html
到了這里,關于【Postman】Newman安裝與環(huán)境配置完整版(內含安裝過程中遇到的問題與解決方案)的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!