zl程序教程

您现在的位置是:首页 >  工具

当前栏目

看阿里测试工程师如何玩转postman+newman+jenkins接口自动化

2023-09-27 14:27:30 时间

目录

一、环境准备

1.安装nodejs6.0+

2.安装newman

3.安装newman-reporter-html

二、本机调试脚本

1.了解命令行执行脚本

2.从postman下载脚本到本机

3.本机调试出报告

三、集成jenkins


postman用来做接口测试非常方便,接口较多时,则可以实现接口自动化

一、环境准备

1.安装nodejs6.0+

安装nodejs6.0+(github上面写的版本要求),用于安装newman4.0+,到nodejs官网下载即可https://nodejs.org/en/download/releases/

2.安装newman

1

npm install -g newman

3.安装newman-reporter-html

1

npm install -g newman-reporter-html

二、本机调试脚本

1.了解命令行执行脚本

可以查看github上面的命令说明https://github.com/postmanlabs/newman#configuring-reporters、GitHub - postmanlabs/newman-reporter-html

run XX.json                                                                 #执行脚本

---reporters html --reporter-html-export /路径             #导出执行结果到此路径,若指定输出报告,则只会在dos窗口输出执行结果

 -e XX.json                                                                  #带上环境变量

2.从postman下载脚本到本机

下载脚本:

下载环境变量:

3.本机调试出报告

newman run D:\test.postman_collection.json --reporters html --reporter-html-export  D:\html01.html

在D盘下生成报告

三、集成jenkins

和其他项目配置jenkins一样,新建一个构建,然后在构建的地方,配置一下,windows的批处理命令

点击立即构建,查看控制台输出

 在D盘下同样会生成报告

 python自动化测试资料下方小卡片领取↓