postman+NewMan+Jenkins

一、postman下载安装

https://www.getpostman.com/

二、postman 发送请求

1.发送get请求

2.发送post请求

https://www.cnblogs.com/shimh/p/6093229.html

三、postman全局变量配置

四、postman环境变量配置

五、批量执行测试用例

六、postman+newman生成测试报告

1.下载node.js 官网

把node.exe的目录加入到环境变量中。假设node.exe位于 C:\nodejs\node.exe。那么将E:\nodejs 加入到环境变量即可。打开cmd,输入node,如果没有报错,而是显示“>”,说明node安装成功。

2.下载newman:

打开cmd输入 

npm install -g newman

再安装html  

npm install -g newman-reporter-html

3.newman使用:

在postman里面export出接口,格式选择V2.1

4、运行测试用例(参考https://www.cnblogs.com/echoqi/p/10264860.html

执行测试用例集:newman run 接口

例如:run /Users/jww/Downloads/华泰-API.postman_collection.json

指定生成报告的位置:r html --reporter-html-export 文件保存路径

例如:newman run /Users/jww/Downloads/华泰-API.postman_collection.json -r html --reporter-html-export /Users/jww/Desktop/JWW

加上环境变量-e

例如:newman run /Users/jww/Downloads/华泰-测试1.postman_collection.json -e /Users/jww/Downloads/htxd2test.moguyun.com.postman_environment.json -r html --reporter-html-export /Users/jww/Desktop/JWW

设置全局变量 -g

例如:newman run test.postman_collection.json -e test.postman_environment.json -g C:\Users\test.postman_global.json >d://error1.log

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容