当前位置:网站首页>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}}
批量执行测试用例
边栏推荐
猜你喜欢
Recommendation | recommendation of 9 psychotherapy books
Delete subsequence < daily question >
[数学建模] 微分方程--捕鱼业的持续发展
How to realize automatic playback of H5 video
A blog to achieve embedded entry
几种RS485隔离通讯的方案介绍
SQL injection vulnerability (MSSQL injection)
Etcd database source code analysis -- etcdserver bootstrap initialization storage
11. Intranet penetration and automatic refresh
CADD course learning (7) -- Simulation of target and small molecule interaction (flexible docking autodock)
随机推荐
ETCD数据库源码分析——etcdserver bootstrap初始化存储
Solve the compilation problem of "c2001: line breaks in constants"
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
Fedora/rehl installation semanage
JVM garbage collector concept
Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022
Fuzzy -- basic application method of AFL
Solutions: word coverage restoration, longest serial number, Xiaoyu buys stationery, Xiaoyu's electricity bill
Database - MySQL storage engine (deadlock)
也算是學習中的小總結
Flink kakfa data read and write to Hudi
How does vs change the project type?
Patent | subject classification method based on graph convolution neural network fusion of multiple human brain maps
SharedPreferences source code analysis
Lombok principle and the pit of ⽤ @data and @builder at the same time
Can Flink SQL read multiple topics at the same time. How to write in with
A blog to achieve embedded entry
Can CDC pull the Oracle table in full
SharedPreferences 源码分析
CertBot 更新证书失败解决