当前位置:网站首页>Postman关联
Postman关联
2022-07-06 04:41:00 【炫酷的腿毛!】
Postman关联
Postman 关联
**介绍:**应用于 多个 http请求之间,有数据关联、或依赖关系时。
实现步骤
A接口 依赖 B接口 的数据
- 向B接口发送http请求,获取数据
- 将数据 设置 至 全局变量(环境变量)中
- A 接口 获取 全局变量(环境变量)中 数据值,进行使用。
案例
请求 获取天气接口, 提取响应结果中的 城市, 将城市名,给百度搜索接口使用。
实现步骤:
- 创建 用例集,分别创建 查询天气 请求 和 百度搜索的请求

在查询天气请求 Tests 中,编写代码 获取 城市名,写入全局变量
// 获取 全部响应结果 var jsonData = pm.response.json() // 从响应结果中 获取 城市名 var city = jsonData.weatherinfo.city // 将城市名写入到全局变量 pm.globals.set("glb_city", city)点击 Send 按钮,发送 请求,查看设置的全局变量。
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EjOH9YRD-1656840638382)(接口测试-第03天-课堂笔记.assets/image-20210709170550685.png)]](/img/13/0e7926c004e69881bd6772c1abf621.png)
修改 百度搜索请求,使用全局变量,按 城市名进行搜索。
http://www.baidu.com/s?wd={ {glb_city}}![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pqlK7dKg-1656840638384)(接口测试-第03天-课堂笔记.assets/image-20210709172113952.png)]](/img/95/70b8733463b513a1d627583898b617.png)
批量执行测试用例


边栏推荐
- [HBZ sharing] how to locate slow queries in cloud database
- Can Flink SQL read multiple topics at the same time. How to write in with
- The web project imported the MySQL driver jar package but failed to load it into the driver
- NPM command -- install dependent packages -- Usage / explanation
- It is also a small summary in learning
- VPP performance test
- Embedded development program framework
- English Vocabulary - life scene memory method
- Bubble sort
- Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
猜你喜欢

程序员在互联网行业的地位 | 每日趣闻
![[05-1, 05-02, 05-03] network protocol](/img/25/2e9ccc3f31a1fd46c9ab643d48064b.jpg)
[05-1, 05-02, 05-03] network protocol

canal同步mysql数据变化到kafka(centos部署)

11. Intranet penetration and automatic refresh

Embedded development program framework

VNCTF2022 WriteUp

MPLS experiment

The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry

Orm-f & Q object

Meet diverse needs: jetmade creates three one-stop development packages to help efficient development
随机推荐
P2102 地砖铺设(dfs&贪心)
. Net interprocess communication
Basic explanation of turtle module - draw curve
[leetcode question brushing day 33] 1189 The maximum number of "balloons", 201. The number range is bitwise AND
Visio draw fan
捷码赋能案例:专业培训、技术支撑,多措并举推动毕业生搭建智慧校园毕设系统
1008 circular right shift of array elements (20 points)
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
Scala function advanced
VPP performance test
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
It is also a small summary in learning
Selection of slow motion function
P3500 [poi2010]tes intelligence test (two points & offline)
Implementation of knowledge consolidation source code 1: epoll implementation of TCP server
ORM aggregate query and native database operation
ISP学习(2)
Embedded development program framework
Flink kakfa data read and write to Hudi
ue5 小知识点 开启lumen的设置