环境准备
Node.js
cnpm/npm
验证安装成功:
node -v
npm -v
安装Newman
newman是为Postman而生,专门用来运行Postman编写好的脚本; 使用newman,你可以很方便的用命令行来执行postman collections
cnpm install newman --global #安装newman
npm install -g newman-reporter-html #安装html
验证安装成功:
newman -v
使用newman命令运行脚本
1.导出脚本,选中合集后右键点击-Export
2.进入到导出的脚本的路径下执行命令:newman run 执行顺序.postman_collection.json -r html
3.运行完之后,打开路径可以看到生成了html的结果
安装jenkins
2.进入Jenkins构建一个项目:postman_api
3.进入项目的配置页面,构建-Execute Windows batch command.然后输入命令,这个命令就是在cmd里执行的命令,保存。
4.保存后,直接构建项目,运行完成。