当前位置:网站首页>Getting started with postman -- built-in dynamic parameters, custom parameters and assertions
Getting started with postman -- built-in dynamic parameters, custom parameters and assertions
2022-07-03 21:02:00 【Little brother said test】
One 、postman Built in dynamic parameters and custom dynamic parameters
1、 Built in dynamic parameters
{ {$timestamp}} Generate current timestamp
{ {$randomInt}} Generate 0~1000 random number
{ {$guid}} Generate a GUID Long string random number
2、 Custom dynamic parameters
stay Pre-request Script
Define parameters in , Then set it as a global variable , And can realize custom dynamic parameters , For example, create a user tag interface , Except for access_token Outside , Transmitted name
Value cannot be duplicate , At this time, we can use { {$timestamp}}
Outside the timestamp tag 【 Be careful , This is a little bad , We don't know that the timestamp is in advance , There are drawbacks in making assertions 】 You can also use custom dynamic parameters .
adopt
Defined a times
Variable . The method of calling custom variables is { { Variable name }}
, There is no need to add the dollar sign .
Two 、postman General assertion 、 Dynamic parameter assertion 、 Global assertion
The assertion should be written in Tests
In the TAB. ,postman Many assertion methods have been provided to us , It's all on the right
Call directly when using , For example, we are getting access_token The interface makes the following assertions
The first is the status code 200;
The second assertion is that the returned string contains access_token character string
stay Tests
Tab cannot be passed { { Variable name }} Method to call global variables , Only through :
1)postman Its own method of obtaining global variables pm.global.get(" Variable name ")
First get , Call again
2)globals[" Variable name "]
3)globals. Variable name
Call in the above three ways
Whether the assertion passes , Will be in Test Results It shows that
Like the status code is 200 This assertion should be the assertion that every use case should make , But if every use case is written once, it's a little bit like Automation , At this time, you can make a global assertion , That is, every use case will judge
for example , We didn't write any assertions in the query tag , But the status code will be carried out after execution 200 The judgment of the :
The first is the status code 200;
The second assertion is that the returned string contains access_token character string
stay Tests
Tab cannot be passed { { Variable name }} Method to call global variables , Only through :
1)postman Its own method of obtaining global variables pm.global.get(" Variable name ")
First get , Call again
2)globals[" Variable name "]
3)globals. Variable name
Call in the above three ways
Whether the assertion passes , Will be in Test Results It shows that
Like the status code is 200 This assertion should be the assertion that every use case should make , But if every use case is written once, it's a little bit like Automation , At this time, you can make a global assertion , That is, every use case will judge
for example , We didn't write any assertions in the query tag , But the status code will be carried out after execution 200 The judgment of the :
The following is the supporting information , For doing 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you !
Last : It can be in the official account : Programmer Xiaohao ! Get a free copy of 216 Page software testing engineer interview guide document information . And the corresponding video learning tutorial is free to share !, It includes basic knowledge 、Linux necessary 、Shell、 The principles of the Internet 、Mysql database 、 Special topic of bag capturing tools 、 Interface testing tool 、 Test advanced -Python Programming 、Web automated testing 、APP automated testing 、 Interface automation testing 、 Testing advanced continuous integration 、 Test architecture development test framework 、 Performance testing 、 Safety test, etc. .
If my blog helps you 、 If you like my blog content , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One button, three links ! Friends who like software testing , You can join our testing technology exchange group :779450660 There are various software testing resources and technical discussions )
边栏推荐
- "Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks
- Cesiumjs 2022 ^ source code interpretation [7] - Analysis of the request and loading process of 3dfiles
- Rhcsa third day notes
- Etcd 基于Raft的一致性保证
- QT6 QML book/qt quick 3d/ Basics
- It is discussed that the success of Vit lies not in attention. Shiftvit uses the precision of swing transformer to outperform the speed of RESNET
- Recommendation of books related to strong foundation program mathematics
- Yyds dry goods inventory TCP & UDP
- jvm jni 及 pvm pybind11 大批量数据传输及优化
- Introduction to golang garbage collection
猜你喜欢
Shortest path problem of graph theory (acwing template)
Such as the visual appeal of the live broadcast of NBA Finals, can you still see it like this?
The global industrial design revenue in 2021 was about $44360 million, and it is expected to reach $62720 million in 2028. From 2022 to 2028, the CAGR was 5.5%
Basic knowledge of dictionaries and collections
Q&A:Transformer, Bert, ELMO, GPT, VIT
Install and use Chrony, and then build your own time server
"Designer universe" argument: Data Optimization in the design field ultimately falls on cost, safety and health | chinabrand.com org
"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks
Battle drag method 1: moderately optimistic, build self-confidence (1)
设计电商秒杀系统
随机推荐
Get log4net log file in C - get log4net log file in C
Mysql database ----- common commands of database (based on database)
In 2021, the global revenue of thick film resistors was about $1537.3 million, and it is expected to reach $2118.7 million in 2028
Discussion Net legacy application transformation
Is flush account opening and registration safe and reliable? Is there any risk?
2022 low voltage electrician examination and low voltage electrician simulation examination question bank
Quickly distinguish slices and arrays
Line segment tree blue book explanation + classic example acwing 1275 Maximum number
Inventory 2021 | yunyuansheng embracing the road
Interval product of zhinai sauce (prefix product + inverse element)
CesiumJS 2022^ 源码解读[7] - 3DTiles 的请求、加载处理流程解析
Brief analysis of ref nerf
Fingerprint password lock based on Hal Library
JS three families
Kubernetes 通信异常网络故障 解决思路
(5) Web security | penetration testing | network security operating system database third-party security, with basic use of nmap and masscan
Scientific research document management Zotero
一台服务器最大并发 tcp 连接数多少?65535?
淺析 Ref-NeRF
For in, foreach, for of