postman-使用newman生成html測試報告


安裝好node.js  

下載地址:https://nodejs.org/zh-cn/

 Node.js安裝和環境變量設置方法https://jingyan.baidu.com/article/64d05a021974acde54f73b70.html

 

二、安裝newman和html

1、教程:https://jingyan.baidu.com/article/ca41422f2b4a6e1eae99edba.html

2、cmd輸入  npm install newman-reporter-html   安裝html  

 

 

三、第在postman內保存接口並導出為json格式文件,找個路徑存放

導出接口 ,如果有變量的話 也要把變量一起導出

 

導出變量

      

 

四、執行命令生成html報告

newman run E:\postman_json\data.json -g E:\postman_globals\globals.json -d E:\csv\csvdata.csv --reporters html --reporter-html-export E:\report\html02.html

 

 

問題:

 

1.配置npm的全局模塊的存放路徑、cache的路徑時,執行命令npm config set prefix "D:\Program Files\nodejs\node_global"后系統無響應,不是加載的那種狀態,而是下標不停地在哪里閃

解決:C:\Users\{賬戶}\下的.npmrc文件刪除掉,就可以重新使用了

 

2.執行以上生成html報告的命令時,若出現異常提示:
newman: "html" reporter could not be loaded.
run `npm install newman-reporter-html`

解決:需要執行命令 npm install -g newman-reporter-html  來全局安裝支持Newman生成html報告的組件然后,

再次執行命令  newman run E:\postman_json\data.json -g E:\postman_globals\globals.json -d E:\csv\csvdata.csv --reporters html --reporter-html-export E:\report\html02.html

 

成功~

 

 

五、查看測試報告~~

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM