編寫自動執行postman的腳本


1.需要安裝newman,newman的安裝需要借助Node.js;
所以先安裝好Node.js,然后配置好Node.js的環境;
安裝Node.js,參考資料: https://www.cnblogs.com/zhouyu2017/p/6485265.html
安裝newman,參考資料: https://blog.csdn.net/suancai1993/article/details/76177356?utm_source=blogxgwz5


2.還需要安裝一個newman-reporter-html的組件

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

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

參考資料:https://www.jianshu.com/p/b70ff4ffb4fc

3.自動執行postman的腳本:
路徑是絕對路徑,文件是.bat,下面的腳本里改一下腳本的路徑和環境變量的路徑就OK了

newman run D:\demoTest\xiApi.postman_collection.json --environment D:\demoTest\xiIP.postman_environment.json --globals D:\demoTest\globals.postman_globals.json --iteration-count 1 --disable-unicode --suppress-exit-code --ignore-redirects --bail --reporters cli,html,json,junit --reporter-html-export D:\demoTest\result.html


免責聲明!

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



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