当前位置:网站首页>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
边栏推荐
- C語言實現掃雷(簡易版)
- 图像PANR
- 消息称腾讯正式宣布成立“XR”部门,押注元宇宙;谷歌前 CEO:美国即将输掉芯片竞争,要让台积电、三星建更多工厂...
- The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
- The AI for emotion recognition was "harbouring evil intentions", and Microsoft decided to block it!
- Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO
- 用手机摄像头就能捕捉指纹?!准确度堪比签字画押,专家:你们在加剧歧视
- 顺序表的基本操作
- 主数据建设的背景
- DX12引擎开发课程进度-这个课程到底讲到哪里了
猜你喜欢

Interpreter mode -- formulas for dating

Bridging mode -- law firm

Implement the redis simple client customized based on socket

建立自己的网站(14)

Builder mode -- Master asked me to refine pills

Freshman girls' nonsense programming is popular! Those who understand programming are tied with Q after reading

图的基本概念以及相关定义

传统的IO存在什么问题?为什么引入零拷贝的?

Bean lifecycle flowchart

Difference between map and object
随机推荐
建立自己的网站(14)
Byte and Tencent have also come to an end. How fragrant is this business of "making 30million yuan a month"?
伯克利、MIT、劍橋、DeepMind等業內大佬線上講座:邁向安全可靠可控的AI
Visitor model -- generation gap between young and middle-aged people
Enjoy yuan mode -- a large number of flying dragons
DX12引擎开发课程进度-这个课程到底讲到哪里了
Accurate calculation of task progress bar of lol mobile game
"Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"
Ribbon source code analysis @loadbalanced and loadbalancerclient
Vxlan and MPLS: from data center to Metro Ethernet
《梦华录》“超点”,鹅被骂冤吗?
苹果不差钱,但做内容“没底气”
情绪识别AI竟「心怀鬼胎」,微软决定封杀它!
海泰前沿技术|隐私计算技术在医疗数据保护中的应用
年轻人捧红的做饭生意经:博主忙卖课带货,机构月入百万
With its own cells as raw materials, the first 3D printing ear transplantation was successful! More complex organs can be printed in the future
Basic properties and ergodicity of binary tree
Bytebase加入阿里云PolarDB开源数据库社区
Selenium crawl notes
Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI