|
newman简介: newman是为Postman而生, 专门用来运行Postman编写好的脚本;使用newman, 你可以很方便的用命令行来执行postman collections 一、安装1.安装node.js
2.安装newman
npm install -g newman
3.安装newman的html报告生成
npm install -g newman-reporter-html
4.安装newman的htmlextra报告生成
npm install -g newman-reporter-htmlextra
二、使用1.导出postman脚本和环境变量
2.用 newman run "导出的.json文件存放路径" --reporters html --reporter-html-export的方式运行
三、举例
输出报告时使用的命令:
-r html,json,junit 指定生成html,json,xml形式的测试报告
--reporter-json-export jsonReport.json 生成json格式的测试报告
--reporter-junit-export xmlReport.xml 生成xml格式的测试报告
--reporter-html-export htmlReport.html 生成html格式的测试报告
默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下
比如:
htmlextra 使用
使用htmlextra套件生成比较高级的html报告
使用方法和html的相同,需要安装htmlextra,命令行中输入:
命令行中执行命令生成测试报告
常见问题:
1.当运行出现unable to verify the first certificate,可在命令后面添加 --insecure
|