一、环境准备
1.安装 nodejs,下载地址 node官网,使用默认安装即可,安装成功后进行验证
1
$ node -v
2.安装 newman
1
2
$ sudo npm install -g newman
$ newman -v
3.安装 newman-reporter-html
1
$ sudo npm install -g newman-reporter-html
二、自定义测试报告
1.组合键 command + space空格键
打开搜索框,输入 newman
并点击进入访达
2.点击进入 newman-reporter-html
文件夹
3.进入 newman-reporter-html/lib
目录
4.找到文件 template-default.hbs
并点击打开编辑此 html 模板即可
三、自动化测试执行
1.导出 postman 自动化测试集
2.导出环境变量并编辑环境变量
3.导出全局变量
4.进入终端执行自动化测试命令
1
$ newman run 测试集文件.json -e 环境变量文件.json -g 全局变量.json --reporters html --reporter-html-export 要生成的测试报告文件名
5.打开测试报告