编写自动执行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