一、接口自动化测试
简介:Newman是postman推出的一个nodejs库,Newman可以方便运行和测试集合,并用之构造接口自动化测试和持续集成。
二、安装和配置
步骤:
先安装node.js
安装newman:npm install -g newman
验证是否安装成功命令:newman -v
成功后会出现对应的版本号
在从postman中导出测试脚本到桌面,之后右键点击脚本,在点击属性
点击安全有对应的脚本路径
常见的参数:
-e: 使用环境变量
-g: 使用全局变量
-d: 使用csv,text,json数据驱动
-n:循环次数 -r :cli,html,json,junit --reporter-html-export
进入命令框输入生成测试报告命令:newman run C:\Users\Lenovo\Desktop\本地测试.postman_collection.json
导出生成测试报告
首先下载html:npm install -g newman-reporter-html
下载成功后导出命令:newman run C:\Users\Lenovo\Desktop\本地测试.postman_collection.json -r html --reporter-html- export report123.html