postman使用指南

本文详细介绍了Postman的使用方法,包括基本的HTTP接口测试、脚本编写技巧、持续集成配置及命令行工具Newman的使用。此外还分享了一些高级技巧如启用Chrome开发者工具进行调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值