接口自动化-postman集成Jenkins
来源:互联网 发布:vb for循环嵌套if 编辑:程序博客网 时间:2024/04/28 19:15
newman
Newman是Postman的一个命令行集合运行者。 它允许您直接从命令行运行和测试Postman集合。 它是以可扩展性为基础构建的,因此您可以轻松将其与持续集成服务器集成并构建系统。
官方简介:https://www.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman
安装newman
通过npm安装,使用淘宝镜像。
命令:npm install -g newman --registry=https://registry.npm.taobao.org
运行postman中导出的用例
命令:newman run test.postman_collection.json(postman导出的文件名称)
也可以将一个集合作为URL来传递(postman中分享的URL)
注:分享URL需要先注册postman
运行命令:newman run https://www.getpostman.com/collections/77272ceeffb136b216a4
注意 :run 后面跟上要执行的json文件或者URL(json 和 URL 都由postman导出生成),后面可加上一些参数,例如环境变量,测试报告,接口请求超时时间等等。一下两个完整的例子做参考
例子1,通过newman 运行postman导出的test1.json文件,并生成多种测试报告(json,junit的xml,html):
newman run c:\test1.json --reporters cli,html,json,junit --reporter-json-export jsonOut.json --reporter-junit-export xmlOut.xml --reporter-html-export htmlOut.html
标红部分修改成需要生成的报告名称:newman run test.postman_collection.json --reporters cli,html --reporter-html-export test.html 此例子中只生成了HTML报告
例子2,运行https://www.getpostman.com/collections/cb0cea0af1467c8008fb(postman生成的 )中的所有api,并使用env.json作为环境变量和globals.json作为全局变量,并使用外部data.csv作为外部数据,最后设置了接口请求超时时间为5S 。
newman run https://www.getpostman.com/collections/77272ceeffb136b216a4 --environment env.json --iteration-data data.csv --globals globals.json --timeout-request 5000
Jenkins集成
新建自由风格的任务
配置Job,存放路径必须为英文路径,输出html的测试报告
命令:newman run test.postman_collection.json --reporters cli,html --reporter-html-export test.html 标红为用例名称
我这里将测试用例存放在Jenkins的workspace\{创建的job目录下}了
构建后操作--设置html文件名称例如:test.html 与生成的html报告名称保持一致
注意:生成HTML报告,将postman导出的用例放在Jenkins的workspace\{创建的job目录下}
如:\workspace\newman_test
生成HTML报告
生成XML报告
命令:newman run test.postman_collection.json --reporters cli,html,json,junit --reporter-json-export test.json --reporter-junit-export test.xml --reporter-html-export test.html
构建后操作--设置 *.xml
生成的XML报告
欢迎关注公众号交流
- 接口自动化-postman集成Jenkins
- 接口自动化测试--postman与Jenkins持续集成
- Postman+Newman+Jenkins APItest自动化集成测试
- Postman+Newman+Jenkins APItest自动化集成测试
- Postman-CI集成Jenkins
- Postman-CI集成Jenkins
- postman+jenkins+newman做接口测试的持续集成
- postman接口自动化测试
- soapUI+maven+Jenkins 搭建接口自动化持续集成平台
- soapUI+maven+Jenkins 搭建接口自动化持续集成平台
- Jenkins+Ant+Jmeter接口自动化集成测试实例
- Jenkins+Ant+Jmeter接口自动化集成测试实例
- jenkins+ant+jmeter接口自动化的持续集成测试框架
- HTTP接口自动化和持续集成(ant+maven+JenKins)
- Jenkins+Ant+Jmeter接口自动化集成测试实例
- Jenkins+maven+jmeter接口可持续集成自动化测试
- linux+ant+jmeter+jenkins搭建接口自动化持续集成平台
- 持续集成接口自动化-jmeter+ant+jenkins(一)
- 数据结构_复习2
- git警告warning: CRLF will be replaced by LF in iris/js/list.js.
- 服务器上配置jupyter
- 微信实习面试感想
- Elasticsearch简介&基本使用
- 接口自动化-postman集成Jenkins
- Ubuntu 14.04下搭建Web服务器(MySQL+PHP+Apache) 教程
- python双下划线含义、MethodType把函数变为方法以及类继承
- 关于原谅
- 【python】基本数据类型
- 64位windows下Xgboost安装血与泪的总结
- eclipse maven配置
- 新linux服务器需要安装的模块
- gradle各个版本资源