newman 在MAC安装及操作步骤

 1. 下载并安装nodejs
 
2. 查看node是否安装成功
MacBook-Pro:~ zmy$ node -v
v15.4.0
 
3. 查看npm是否安装成功
MacBook-Pro:~ zmy$ npm -v
7.0.15
 
4. 安装newman
npm install -g newman
 
5 查看newman是否安装成功
newman -v
 
6. 导出要批量执行的接口文件夹
 
 
 
7. 执行导出的json文件
newman run BestTest.postman_collection.json
 

 

 

8、输出测试报告文件

newman 支持四种格式报告文件:cli,json,html,junit

 8.1  生成 html 报告时需要安装html套件,命令行中执行:

    npm install -g newman-reporter-html

 8.2 输出报告时使用的命令:
    -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格式的测试报告
    默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下

  例如:newman run BestTest.postman_collection.json  -r html,json --reporter-json-export jsonReport.json --reporter-html-export htmlReport.html

 

posted @ 2020-12-17 17:25  Mia妈妈加油呀  阅读(1083)  评论(0)    收藏  举报