postman+newman+jenkins接口自动化

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

目录

1、环境准备

2、本机调试脚本

3、集成jenkins

1、环境准备

1.1安装nodejs6.0+

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

1.2安装newman

npm install -g newman

1.3安装newman-reporter-html

npm install -g newman-reporter-html

  

2、本机调试脚本

2.1了解命令行执行脚本

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

run XX.json                                                                 #执行脚本

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

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

2.2从postman下载脚本到本机

下载脚本:

下载环境变量:

2.3本机调试出报告

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

在D盘下生成报告

3、集成jenkins

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

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

 在D盘下同样会生成报告

另:

1、还可以配置发送邮件等,本篇暂未介绍

原文地址:https://www.cnblogs.com/weizhideweilai/p/9801003.html