Newman+postman自动化测试
- postman
- Pre-request Script前置脚本
 
- Newman
- 测试报告输出
 
postman
学习postman脚本编写
Pre-request Script前置脚本
Newman
测试报告输出
输出报告时使用的命令:
     -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格式的测试报告
     默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下
例:输出json和html文件报告
 newman run APITest.postman_collection.json -r html,json --reporter-json-export jsonReport.json --reporter-html-export htmlReport.html
执行命令后生成结果
 
htmlextra 使用
   使用htmlextra套件生成比较高级的html报告
   使用方法和html的相同,需要安装htmlextra,命令行中输入:
   npm install -g newman-reporter-htmlextra
   命令行中执行命令生成测试报告
   newman run APITest.postman_collection.json -r htmlextra --reporter-html-export htmlReport.html
   执行后生成测试报告文件:
   
 