当前位置:网站首页>day13--postman interface test
day13--postman interface test
2022-08-04 05:00:00 【Ning Mang】
I. Introduction to interface functions
2. Postman daily operation
1. Use of global variables (Globals)
Description: Usually, the parts we use together can be stored in all variables, and only need {{variable name}}, applicable to all interfaces
For example: mobile phone number attribution and weather query
2. Use of environment variables (Environment variables)
Description: Different environments in the company, configure the data of different environments, only need {{variable name}} is enough, the interface applicable to the current environment, such as different domain names (different IPs within the company)
3. Interface association
1: Interface association method: json extractor 
Implementation method: json extraction
// The return value is converted into a json objectvar jsondata=pm.response.json()console.log(jsondata)// extract value by json expressionvar doer = jsondata.result.cityconsole.log(doer)// set global variablepm.globals.set("cs", doer);
// Get the text content of the response bodyvar resbody = responseBody;console.log(resbody)// Convert to json objectvar jsonobj = JSON.parse(responseBody)// extract value by json expressionvar pro = jsonobj.result.provincepm.globals.set("prodes", pro);
Words:
Set the assertion on the first interface, get the content of the return body and convert it into a json object, extract the desired value through the json expression, set the value to a global variable, and use { in the second interface{variable name}} instead, implement interface association
4. Assertion
Description: Often used to compare expected and actual results
Several ways for Tests to respond to assertions(1) Status code: code is 200 (check whether the response header contains a certain value)(2) response body:contains string (check whether the returned result contains a certain string)(3) response body: Json value check (check whether a field in the returned result is equal to a certain fieldvalue)(4) response header:content-type header check (check whether the response header contains a certain value)(5) response time is less than 200ms (check whether the response time is less than 200ms)(6) response body:Is equal to string (check whether the returned result is equal to the string) useless
边栏推荐
- [Skill] Using Sentinel to achieve priority processing of requests
- 系统设计.秒杀系统
- C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.5 数组和指针的其他区别
- C Expert Programming Chapter 5 Thinking about Linking 5.1 Libraries, Linking and Loading
- 21 days learning challenge 】 【 sequential search
- day13--postman接口测试
- 详解八大排序
- Uni-app 小程序 App 的广告变现之路:全屏视频广告
- How to simplify the automation of modern e-procurement?
- 结构体函数练习
猜你喜欢
mysql index notes
看DevExpress丰富图表样式,如何为基金公司业务创新赋能
The Shell function
[Cloud Native--Kubernetes] Pod Resource Management and Probe Detection
2022年软件测试——精选金融银行面试真题
TL431的基本特性以及振荡电路
There is an 8 hour difference between the docker installation of mysql and the host.
结构体指针知识要点总结
[21 Days Learning Challenge] Image rotation problem (two-dimensional array)
System design. How to design a spike system (full version transfer)
随机推荐
unity框架之缓存池
烧录场景下开发如何进行源代码保密工作
【21 Days Learning Challenge】Direct Insertion Sort
文件系统的简单操作
C Expert Programming Chapter 5 Thinking about Linking 5.2 Advantages of Dynamic Linking
SVM介绍以及实战
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.4 使声明与定义相匹配
ADC噪声全面分析 -03- 利用噪声分析进行实际设计
TL431的基本特性以及振荡电路
10 Convolutional Neural Networks for Deep Learning 3
Mini program + e-commerce, fun new retail
How to dynamically add script dependent scripts
八年软件测试工程师带你了解-测试岗进阶之路
Write golang simple C2 remote control based on gRPC
结构体指针知识要点总结
drools从下载到postman请求成功
Basic characteristics of TL431 and oscillator circuit
JVM笔记
Towards Real-Time Multi-Object Tracking (JDE)
2022 software test interview questions The latest ByteDance 50 real interview questions, 15k have been won after brushing, with explanation + Q&A