一、环境配置

Postman

postman 的具体使用可以参考另外一篇文章:postman 做接口测试之学习笔记

Newman

第一步,安装nodejs。 
第二步,在nodejs命令行安装newman,即命令行输入如下命令:

npm install -g newman

jenkins

去官网(https://jenkins.io/index.html)下载jenkins

二、Postman + Newman + jenkins 的使用

1. 在postman中导出testcase 文件夹(即存各个接口的collection文件夹)和设置的环境变量文件。

如下所示,导出来的是个json 格式的文件

2. jenkins配置

注意:如果是安装在本地的Jenkins,要将jenkins开启,切换到jenkins.war 的路径下, 执行 java -jar jenkins.war 则可以开启了。

在jenkins上配置如下图,这个路径就是上面通过postman导出文件的路径。

剩下的就是jenkins的常规操作了,比如设置好邮箱后点击立即构建或者设置多久构建一次,这样自动化就跑起来了,等待自动化测试结束后我们就可以收到测试成功或者失败的测试报告邮件了(依赖于设置)。

通过上面这些步骤即可完成基于postman和Jenkins的自动化接口测试。

Newman的使用:

可以参考:

Newman - Running collections in the command line

newman 官方文档

newman github

Usage: newman [options]

  Options:

    -h, --help                      output usage information
-V, --version output the version number
-c, --collection [file] Specify a Postman collection as a JSON [file]
-u, --url [url] Specify a Postman collection as a [url]
-f, --folder [folder-name] Run a single folder from a collection. To be used with -c or -u
-e, --environment [file] Specify a Postman environment as a JSON [file]
--environment-url [url] Specify a Postman environment as a URL
-E, --exportEnvironment [file] Specify an output file to dump the Postman environment before exiting [file]
-d, --data [file] Specify a data file to use either json or csv
-g, --global [file] Specify a Postman globals file [file]
-G, --exportGlobals [file] Specify an output file to dump Globals before exiting [file]
-y, --delay [number] Specify a delay (in ms) between requests
-r, --requestTimeout [number] Specify a request timeout (in ms) for requests (Defaults to if not set)
-R, --avoidRedirects Prevents Newman from automatically following redirects
-s, --stopOnError Stops the runner with code= when a test case fails
-j, --noSummary Doesn't show the summary for each iteration
-n, --number [number] Define the number of iterations to run
-C, --noColor Disable colored output
-S, --noTestSymbols Disable symbols in test output and use PASS|FAIL instead
-k, --insecure Disable strict ssl
-l, --tls Use TLSv1
-N, --encoding [encoding-type] Specify an encoding for the response. Supported values are ascii,utf8,utf16le,ucs2,base64,binary,hex
-x, --exitCode Continue running tests even after a failure, but exit with code=. Incompatible with --stopOnError
-o, --outputFile [file] Path to file where output should be written [file]
-O, --outputFileVerbose [file] Path to file where full request and responses should be logged [file]
-t, --testReportFile [file] Path to file where results should be written as JUnit XML [file]
-i, --import [file] Import a Postman backup file, and save collections, environments, and globals [file] (Incompatible with any option except pretty)
-p, --pretty Enable pretty-print while saving imported collections, environments, and globals
-H, --html [file] Export a HTML report to a specified file [file]
-W, --whiteScreen Black text for white screen
-L, --recurseLimit [limit] Do not run recursive resolution more than [limit] times. Default = . Using will prevent any variable resolution Newman is a command-line collection runner for Postman. You must specify a collection file or a collection URL to run newman A collection file or URL is mandatory
Examples: newman -c POSTMAN_COLLECTION
newman -u POSTMAN_COLLECTION -e POSTMAN_ENVIRONMENT
newman -c POSTMAN_COLLECTION -f SAMPLE_FOLDER For more documentation, issues and examples head over to https://github.com/postmanlabs/newman

Postman + newman + jenkins 的API自动化测试应用的更多相关文章

  1. Postman+Newman+jenkins实现API自动化测试

    最近自己在学习用postman+newman+jenkins实现API自动化测试,这里做个回顾和记录.(此次是在windows上进行的环境搭建) 一.说明 1.大致思路:利用postman做接口调试所 ...

  2. Postman+newman+jenkins+git实战

    一.接口分类,流程,用例设计 接口分类: 外部接口:被测系统与外部其他系统之间的接口. 承保系统(被测系统),核算系统. 内部接口:被测系统内部各个子模块之间的接口. 承保系统(A模块,B模块) 测试 ...

  3. postman+newman+jenkins环境部署

    postman+newman+jenkins 环境部署 2017年4月27日 14:33 阅读 11 新浪博客 1.postman: http://itfish.net/article/59864.h ...

  4. Postman+Newman+Jenkins APItest自动化集成测试

    postman做接口测试简单易用很容易上手,但是接口越来越多,每次手动点击runner进行测试不灵活,最近就研究了下newman,利用newman实现接口的自动化测试,但是每次需要命令行操作也不方便, ...

  5. Newman+Jenkins实现接口自动化测试

    目录 一.是什么Newman 二.如何安装 三.如何使用 1.运行本地文件 2.运行在线文件 3.以node.js库运行 4.导出报告 四.命令行测试真实接口 1.导出collection文件 2.导 ...

  6. SpringBoot集成Swagger,Postman,newman,jenkins自动化测试.

    环境:Spring Boot,Swagger,gradle,Postman,newman,jenkins SpringBoot环境搭建. Swagger简介 Swagger 是一款RESTFUL接口的 ...

  7. Web API 持续集成:PostMan+Newman+Jenkins(图文讲解)

    本文由葡萄城技术团队于博客园原创并首发 转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 上篇文章我们已经完成了API测试工具选型,接下来是一系列周期性的开发 ...

  8. postman+newman+jenkins 接口自动化问题

    声明:个人原创,转载请注明 1.安装postman工具 下载地址:https://www.getpostman.com/点击下载,选择自己的系统,我的是windows系统,64位 2.postman ...

  9. postman+newman+jenkins

    1.postman: http://itfish.net/article/59864.html(网上参考资料) 1)安装(要用爬墙软件): 进入下面地址https://chrome.google.co ...

随机推荐

  1. 题目1161:Repeater(规律输出图形)

    题目1161:Repeater 题目链接:http://ac.jobdu.com/problem.php?pid=1161 具体分析:https://github.com/zpfbuaa/JobduI ...

  2. LeetCode 38 Count and Say(字符串规律输出)

    题目链接:https://leetcode.com/problems/count-and-say/?tab=Description   1—>11—>21—>1211—>111 ...

  3. isolinux.cfg 文件是干什么的

    1.   首先光盘镜像也就是iso文件采用的是“ISO 9660 ”文件系统 . cd上的文件都存在这个简单的iso文件系统里,linux可以用mount  -o loop 直接把*.iso文件mou ...

  4. 23种设计模式之访问者模式(Visitor)

    访问者模式是一种对象的行为性模式,用于表示一个作用于某对象结构中的各元素的操作,它使得用户可以再不改变各元素的类的前提下定义作用于这些元素的新操作.访问者模式使得增加新的操作变得很容易,但在一定程度上 ...

  5. httpWebRequest获取流和WebClient的文件抓取

    httpWebRequest获取流和WebClient的文件抓取 昨天写一个抓取,遇到了一个坑,就是在获取网络流的时候,人为的使用了stream.Length来获取流的长度,获取的时候会抛出错误,查了 ...

  6. Unity3D笔记 英保通八 关节、 布料、粒子系统

    一.关节1.1..链条关节 Hinge joint :他可以模拟两个物体间用一根链条连接在一起的情况,能保持两个物体在一个固定距离内部相互移动而不产生作用力,但是达到固定距离后就会产生拉力 1.2.. ...

  7. yii---获取当前sql语句

    我们在用YII开发项目的时候,会查看当前执行的SQL语句来排查错误,那么YII该如何获取当前的SQL语句呢? $list = user::find()->where(['title'=>$ ...

  8. numpy中的reshape中参数为-1

    上篇文章中的reshape(-1,2),有的时候不明白为什么会有参数-1,可以通过查找文档中的reshape()去理解这个问题 根据Numpy文档(https://docs.scipy.org/doc ...

  9. Nodejs express、html5实现拖拽上传

    一.前言 文件上传是一个比较常见的功能,传统的选择方式的上传比较麻烦,需要先点击上传按钮,然后再找到文件的路径,然后上传.给用户体验带来很大问题.html5开始支持拖拽上传的需要的api.nodejs ...

  10. 结对编程2—Fault&Error&Failure

    学习进度表 点滴成就 学习时间 新编写代码行数 博客量(篇) 学到知识点 第一周 8 0 0 了解软件工程 第二周 10 0 1 博文一篇 第三周 15 0 2 选择项目.调查问卷 第四周 20 80 ...