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 沙箱

postman向就是一个js执行环境,在这个环境下可以写pre-script和test-script
在这里插入图片描述

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

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,不再作为谷歌浏览器插件使用,也可以使用console.log

在这里插入图片描述

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

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

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

1.chrome浏览器地址栏输入chrome://flags, enable debugging for packed apps, restart.
这里写图片描述

2.输入chrome://inspect/#apps 点击inspect
这里写图片描述

这样就可以调试postman了。


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

posted @ 2022-03-06 10:39  叶常落  阅读(224)  评论(0编辑  收藏  举报