postman使用指南

postman教程

postman官方教程堪称顶级教学教程,通俗易懂,流畅自然,读起来真是爽快啊
https://learning.getpostman.com/docs/postman/sending_api_requests/requests
https://github.com/postmanlabs/newman#external-reporters

基本

基本的就是单个的http接口测试,没什么好说的

postman脚本,脚本运行在沙箱中

postman脚本其实就是js,
执行顺序 pre-request scripts -> request -> response -> test script
postman使用指南_第1张图片

postman 沙箱

postman向就是一个js执行环境,在这个环境下可以写pre-script和test-script
postman使用指南_第2张图片

可以设置下一个要执行的请求

Let’s now add postman.setNextRequest() to Request 1’s test script, as shown. postman.setNextRequest() is a function with one argument, which is the name or ID of the request you want to run next.

持续集成

持续集成,自动化,需要有命令行级别的接口
postman 把一切当作json来存储,这令人敬佩

npm install newman -g
npm install -g newman-reporter-html
$ newman run /path/to/collection.json -r cli,html

postman使用指南_第3张图片

使用原生版postman,不再作为谷歌浏览器插件使用,也可以使用console.log

postman使用指南_第4张图片

postman使用技巧【已废弃,只针对浏览器插件版】

除了日常的使用,postman有一些稍微隐蔽的使用方法,例如我在使用postman的时候想使用调试功能,想查看日志,那么通过如下操作可以启用谷歌浏览器开发者工具

谷歌浏览器真是博大精深啊

1.chrome浏览器地址栏输入chrome://flags, enable debugging for packed apps, restart.
postman使用指南_第5张图片

2.输入chrome://inspect/#apps 点击inspect
postman使用指南_第6张图片

这样就可以调试postman了。


英文原文:
Enabling Chrome Developer Tools inside Postman
http://blog.getpostman.com/2014/01/27/enabling-chrome-developer-tools-inside-postman/

你可能感兴趣的:(工具)