一、准备工作:
1、postman 安装:建议最好下载应用,而非插件,下载不再细说
2、newman安装:
windows 安装:
32 位安装包下载地址 : https://nodejs.org/dist/v4.4.3/node-v4.4.3-x86.msi
64 位安装包下载地址 : https://nodejs.org/dist/v11.0.0/node-v11.0.0-x64.msi
环境变量中path添加C:\Users\1003916\AppData\Roaming\npm
newman 安装:cmd 执行 npm install -g newman
3、jenkins安装:不再细说
二、jenkins配置:
系统配置和插件下载就不再细说,前一篇文章有细说,主要讲一下命令的执行:
1、Windows批处理命令:
(1)npm install newman -g
(2)cd C:\Users\1003916\AppData\Roaming\npm
newman run guofang.postman_collection.json --reporters cli,html,json,junit --reporter-json-export jsonOut.json --reporter-junit-export xmlOut.xml --reporter-html-export htmlOut.html
(3)xcopy /E/I/Y "C:\Users\1003916\AppData\Roaming\npm\htmlOut.html" "C:\Program Files (x86)\Jenkins\workspace\postmantest\test\junit\html"
2、Post-build Actions---Publish HTML reports:
最后配置完成后,点击构建
三、遇到问题:
postman+newman+Jenkins---控制台输出乱码问题:https://www.cnblogs.com/unknows/p/8519636.html