当前位置:网站首页>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 按钮,发送 请求,查看设置的全局变量。
修改 百度搜索请求,使用全局变量,按 城市名进行搜索。
http://www.baidu.com/s?wd={ {glb_city}}
批量执行测试用例
边栏推荐
- A blog to achieve embedded entry
- Mysql database storage engine
- Can Flink SQL read multiple topics at the same time. How to write in with
- CADD course learning (8) -- virtual screening of Compound Library
- 电脑钉钉怎么调整声音
- npm命令--安装依赖包--用法/详解
- How to realize automatic playback of H5 video
- web工程导入了mysql驱动jar包却无法加载到驱动的问题
- Microservice resource address
- 程序员在互联网行业的地位 | 每日趣闻
猜你喜欢
Visio draws Tai Chi
解决“C2001:常量中有换行符“编译问题
[FreeRTOS interrupt experiment]
满足多元需求:捷码打造3大一站式开发套餐,助力高效开发
How do programmers teach their bosses to do things in one sentence? "I'm off duty first. You have to work harder."
DMA use of stm32
Redis - redis in action - redis actual combat - actual combat Chapter 1 - SMS login function based on redis - redis + token shared session application - with code
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
Unity screen coordinates ugui coordinates world coordinates conversion between three coordinate systems
8. Static file
随机推荐
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
View 工作流程
Can Flink SQL read multiple topics at the same time. How to write in with
Visio draws Tai Chi
SQL注入漏洞(MSSQL注入)
How do programmers teach their bosses to do things in one sentence? "I'm off duty first. You have to work harder."
Bubble sort
P3500 [poi2010]tes intelligence test (two points & offline)
Can CDC pull the Oracle table in full
Certbot failed to update certificate solution
Tengine kernel parameters
CADD course learning (7) -- Simulation of target and small molecule interaction (flexible docking autodock)
Coreldraw2022 new version new function introduction cdr2022
力扣(LeetCode)186. 翻转字符串里的单词 II(2022.07.05)
tengine 内核参数
也算是學習中的小總結
canal同步mysql数据变化到kafka(centos部署)
捷码赋能案例:专业培训、技术支撑,多措并举推动毕业生搭建智慧校园毕设系统
cdc 能全量拉去oracle 表嘛
P2022 interesting numbers (binary & digit DP)