当前位置:网站首页>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
边栏推荐
- Towards Real-Time Multi-Object Tracking(JDE)
- C专家编程 第5章 对链接的思考 5.6 轻松一下---看看谁在说话:挑战Turning测验
- 2022 software test interview questions The latest ByteDance 50 real interview questions, 15k have been won after brushing, with explanation + Q&A
- 2.15 keil使用电脑端时间日期
- C专家编程 第5章 对链接的思考 5.1 函数库、链接和载入
- SVM介绍以及实战
- [Skill] Using Sentinel to achieve priority processing of requests
- 应届生软件测试薪资大概多少?
- QT 如何识别文件的编码格式
- For Qixi Festival, I made a confession envelope with code
猜你喜欢
leetcode 12. Integer to Roman numeral
SQL interview Questions
Get the selected content of the radio box
【C语言进阶】程序环境和预处理
mysql索引笔记
看DevExpress丰富图表样式,如何为基金公司业务创新赋能
你以为border-radius只是圆角吗?【各种角度】
How to simplify the automation of modern e-procurement?
Structure function exercise
Postgresql source code (66) insert on conflict grammar introduction and kernel execution process analysis
随机推荐
商城系统APP如何开发 都有哪些步骤
某母婴小程序加密参数解密
看DevExpress丰富图表样式,如何为基金公司业务创新赋能
centos 安装postgresql13 指定版本
7. The principle description of LVS load balancing cluster
Deep learning -- CNN clothing image classification, for example, discussed how to evaluate neural network model
7-1 LVS+NAT load balancing cluster, NAT mode deployment
Reproduce 20-character short domain name bypass
Towards Real-Time Multi-Object Tracking (JDE)
go module的介绍与应用
Will the 2023 PMP exam use the new version of the textbook?Reply is here!
Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
DataTable uses Linq for grouping and summarization, and converts the Linq result set into DataTable
【一步到位】Jenkins的安装、部署、启动(完整教程)
2.15 keil使用电脑端时间日期
mysql index notes
技术解析|如何将 Pulsar 数据快速且无缝接入 Apache Doris
深度学习21天——准备(环境配置)
Cache pool of unity framework
关于yolo7和gpu