当前位置:网站首页>Interface Association of postman
Interface Association of postman
2022-06-30 01:15:00 【Software testing Xiaobai】
In the project , Multiple interfaces are related to each other before .
Such as : After registration, you can log in , It is impossible for a business to add, delete, modify, and query one interface at a time , If a parameter can be added, modified, and then deleted D It's all related , You need to get the first interface , Then when the following interface is used, you can call
Here is an example : The request needs to log in to get token, The next request needs to carry the corresponding token To make a request
One 、json The extractor implements Interface Association
1、 Request login interface , The corresponding... Is returned after success token
Cold start : When starting the app , There is no process for this application in the background , At this time, the system will re create a new process to assign to the application , The starting mode is cold starting .
Hot start : When starting the app , The application process already exists in the background ( example : Press back key 、home key , The app will exit , However, the process of the application will still remain in the background , You can enter the task list to view ), So in the case of existing processes , This startup will start the application from the existing process , This startup mode is called hot startup .

2、 After the first step is successful Tests Pass through js To set global variables
//json The extractor gets the return value
var jsonData = pm.response.json();
// You can print and view the returned token value
console.log(jsonData.detail.token)
// Obtain the corresponding value according to the interface result level , Set to global variable
pm.globals.set("token", jsonData.detail.token);

After sending, you can view the details in the control view :

See global variable value :

3、 Send the second interface request , It can be done by { {token}} Reference the set global variable

4、 Send a request

Two 、 The regular expression extractor implements interface correlation
It is still after the first step of the request Tests Pass through js To set up
//match matching , obtain token value
var result = responseBody.match(new RegExp('"token":"(.*?)"'))
// Take the subscript 1 Value
console.log(result[1]);
// Set to global variable
pm.globals.set("token",result[1]);

Other operations are the same as above .
welfare

边栏推荐
- Online sql to CSV tool
- If the amount exceeds 6 digits after the decimal point, only 6 digits will be reserved, and if it is less than 6 digits, it will remain the same - Basic accumulation
- After the element uses align items center and overflow auto, some contents are not fully displayed
- Sentinel source code analysis Chapter 9 - core process - lookprocesschain finding resource processing chain
- C language final without failing (Part 1)
- 英伟达Jetson Nano的初步了解
- Sfdp 超级表单开发平台 V6.0.4 正式发布
- [mrctf2020]ezpop-1 | PHP serialization
- Stimulus reports reporting tool, stimulus creates and builds reports
- numpy的索引和图片的索引一样吗?
猜你喜欢

Wechat applet - requestsubscribemessage:fail can only be invoked by user tap gesture

测试用例设计方法之等价类划分方法

Solving plane stress problem with MATLAB

How to build your own blog website by yourself

Nested call and chained access of functions in handwritten C language

如何在IDEA中自定义模板、快速生成完整的代码?

IDEA中的常用设置

I learned database at station B (V): DQL exercise

Interviewer: how to solve the problem of massive requests for data that does not exist in redis, which affects the database?

Tetris game based on STM32F103
随机推荐
DL: deep learning model optimization model training skills summary timely automatic adjustment of learning rate implementation code
MySQL installation steps (detailed)
[spark] basic Scala operations (continuous update)
田口实验法
Unity编辑器随机生成物体,更换场景之后物体丢失问题解决
Stringredistemplate disconnects and the value disappears
Some thoughts on small program subcontracting and verification of uiniapp subcontracting optimization logic
如何拒绝期末复习无用功?猿辅导:找准适合自己的复习方法很重要
Questions about database: database attachment
数据中台咋就从“小甜甜”变成了“牛夫人”?
Equivalence class partition method for test case design method
Visual Studio 2017 无法打开包括文件: “QOpenGLFunctions_3_3_Core”: No such file or directory
Mechanical --nx2007 (UG) -- gap analysis (interference inspection)
How does webapi relate to the database of MS SQL?
HC32M0+ GPIO
如何查看一个文件夹下所有文件的大小?
How to switch to root in xshell
CSV文件格式——方便好用个头最小的数据传递方式
Command line Basics
解决choice金融终端Excel/Wps插件修复visual basic异常