当前位置:网站首页>Variable setting in postman
Variable setting in postman
2022-06-24 20:48:00 【m0_ sixty-two million four hundred and ninety-six thousand nine】
1. Variable ( overall situation / aggregate / Environmental Science )
Variables allow us to store and reuse their values in requests or scripts , By saving values in variables , You can assemble , Environment or request .
For us to do interface testing , Another very important function .
stay postman The three commonly used variables are global variables , environment variable , Set variable .
(1.) Global variables : Once global variables are declared , Global availability , in other words postman Any set in , This variable can be used in any request . Its scope is the largest .
(2.) environment variable : To declare environment variables , First of all, the creation environment , Then variables can be created in the environment . If you want to use environment variables , You have to choose first ( Import ) This environment , So you can use variables in this environment . It should be noted that the environment can also create multiple . There can be multiple variables in each environment .
(3.) Set variable : Set variables are set specific , That is to say, the declared variable must be based on a collection , Its scope of use is only valid for this collection .
Their scope ranges from large to small : Global variables > Set variable > environment variable . When the same variable is declared in several different scopes , The smallest variable will be used in priority to make .
To use a value in a variable, simply 2 A step , They are defining variables and getting variables .
Defining variables ( Set a variable )
Get variable ( Access variables )
Define global variables and environment variables , Click the pinion in the upper right corner to pop up the following interface , You can define global variables or environment variables according to requirements .

Global variables and environment variables that have been defined , You can do a quick look
Define set variables
Select a collection , Open to see more actions (...) menu , Then click Edit . choice “ Variable ” Tab to edit or add to collection variables
Get variable Define variables , Then you can use variables . It should be noted that , Get variables in different places , The rules of writing are also different .
If you get the variable in the request parameter , Whether it's getting global variables , Or environment variables , Or set variables , The way to get it is the same writing rules :{ { Variable name }}
The request parameters refer to :URL,Params , Authorization , Headers , Body
Get environment variables :pm.environment.get(‘ Variable name ’)
Get global variables :pm.globals.get(' Variable name ')
Get collection variables :pm.pm.collectionVariables.get.get(' Variable name ')
If it's where the code is written (Tests,Pre-requests Script) Get variable , Get different types of variables , The code is different , As follows :

Variables are used in a wide range of scenarios , For example, we will talk about Interface Association later , Variables are used in the pre request script
边栏推荐
- 基于QT+MySQL的相机租赁管理系统
- “拯救”直播带货,一个董宇辉还不够
- 红象云腾完成与龙蜥操作系统兼容适配,产品运行稳定
- Bytebase joins Alibaba cloud polardb open source database community
- 图的基本概念以及相关定义
- You can capture fingerprints with a mobile camera?! Accuracy comparable to signature and monogram, expert: you are aggravating discrimination
- [multi thread performance tuning] multi thread lock optimization (Part 1): optimization method of synchronized synchronization lock
- Difference between map and object
- The JS method parameter passed a number beginning with 0. A magical problem occurred and bothered me for a long time
- Leetcode(455)——分发饼干
猜你喜欢

Agency mode -- Jiangnan leather shoes factory

海泰前沿技术|隐私计算技术在医疗数据保护中的应用

Internet of things? Come and see Arduino on the cloud

Cooking business experience of young people: bloggers are busy selling classes and bringing goods, and the organization earns millions a month

Vant component used in wechat applet

对“宁王”边卖边买,高瓴资本“高抛低吸”已套现数十亿

顺序栈遍历二叉树

Memo mode - game archiving

在Dialog中使用透明的【X】叉叉按钮图片

The four stages of cloud computing development have finally been clarified
随机推荐
OpenVINO2022 Dev Tools安装与使用
Compressed list of redis data structures
The latest simulated question bank and answers of the eight members (Electrical constructors) of Sichuan architecture in 2022
在Dialog中使用透明的【X】叉叉按钮图片
Prototype mode -- clone monster Army
主数据建设的背景
Grating diffraction
苹果不差钱,但做内容“没底气”
Undo log and redo log must be clear this time
Stackoverflow annual report 2022: what are developers' favorite databases?
Otaku can't save yuan universe
You can capture fingerprints with a mobile camera?! Accuracy comparable to signature and monogram, expert: you are aggravating discrimination
The four stages of cloud computing development have finally been clarified
Design of routing service for multi Activity Architecture Design
开放可编程基础设施(OPI)项目,重新定义DPU/IPU
Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!
用手机摄像头就能捕捉指纹?!准确度堪比签字画押,专家:你们在加剧歧视
Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
物联网?快来看 Arduino 上云啦
托管服务与SASE,纵享网络与安全融合 | 一期一会回顾