环境准备:
1.
一、安装nodejs
1.安装Newman需要先安装nodejs 下载地址: http://nodejs.cn/download/
下载后一路next ,安装后,打开cmd,输入node -v ,看到输出node的版本信息,即代表安装成功,环境变量设置也正确。
二、安装newman
cmd输入 npm install newman –g
安装完成后,输入指令 newman -v 查看版本,检测是否安装成功,这里注意,newman的包被安装在了npm工具的包下
如上图,即安装正确,接下来安装html报告
npm install -g newman-reporter-html
执行测试
1.将测试接口保存到指定collection
2.导出collection 格式为json格式
3.NewMan执行脚本
执行测试用例集,并生成测试报告
newman run xxx.json -r html --reporter-html-export 导出的目录