当前位置:网站首页>Metersphere tutorial: how to assert when the returned result of the interface is null
Metersphere tutorial: how to assert when the returned result of the interface is null
2022-06-11 01:54:00 【Growth path of Xiaobo test】
background :
Recently in use Metersphere When doing interface tests , When asserting , Some abnormal scenarios are to check whether the data cannot be found , The problems encountered in asserting are shared with you :
First, let's look at if python in , What if the return result is empty :

Next , Debug the interface in the platform , When making assertions :
1、 Try assertions first Response Data Is it null perhaps "", Then the results are as follows :

As can be seen from the screenshot above , The assertion ended in failure , It is possible that when the returned result is null , I don't know what has been done, but there are still bug, Anyway, the assertion in this case is inconvenient
2、 Use script assertions
Ideas : Call the global function first prev.getResponseDataAsString() Get the return result . Then judge whether the returned result is == "" .

It turns out that doing so can assert success :

The feeling of using :
Although the platform is for people who can't write code , It provides certain convenience , however , There is also a certain learning cost , Especially when some scripts report errors , Debugging and positioning problems are not very convenient .
ps: I was in v1.18.xxx To try the version of , It is not ruled out that the later official fixes this problem , Or it's the wrong way to use it , Or right Response Data Your understanding is wrong, huh !
Refer to summary
That's what this article wants to share , If you have any questions , Welcome to the official account - Xiaobo tests the way of growth and leaves messages for communication .
Writing is not easy , I think it's good. Please click three times , Your support is my biggest driving force for continuous output .
边栏推荐
- Leetcode 698 partition to K equal sum subsets (DFS pruning)
- 2021-2-26编程语言知识点整理
- 1.2. Ros+px4 preliminary basic knowledge
- Byte Beijing 23K and pinduoduo Shanghai 28K, how should I choose?
- [leetcode] reverse linked list II
- Win11怎么更改管理员头像?Win11更换管理员头像的方法
- Detailed explanation of classic papers on OCR character recognition
- [leetcode] delete duplicate Element II in the sorting linked list
- 逻辑漏洞 / 业务漏洞
- [leetcode] balanced binary tree
猜你喜欢
随机推荐
【HaaS Hands-On】全新视频节目上线 创意案例我们一起上手做 第一期E01: 物联网工程师 和你一起上手做遥控机械臂
LeetCode 1024 Video Stitching (dp,jump game)
【圖像處理】基於matlab GUI多功能圖像處理系統【含Matlab源碼 1876期】
Kubernetes binary installation (v1.20.15) (VII) plug a work node
On permutation and combination in probability and statistics
From "0" to "tens of millions" concurrency, 14 technological innovations of Alibaba distributed architecture
What if ROS lacks a package
threejs:流光效果封装
Leetcode binary tree problem
LeetCode 1749 Maximum Absolute Sum of Any Subarray (dp)
2.2. Ros+px4 simulation multi-point cruise flight - Square
[leetcode] construct a binary tree by traversing the sequence from front to middle (continuous optimization)
Video compression data set TVD
【MATLAB】图像分割
Win11系统使用DISM命令备份驱动程序的方法
Exj shaped children will be satisfied with mbtxe due to disconnection
2021-02-27image processing of MATLAB
[leetcode] reverse linked list II
5月B站榜单丨飞瓜数据UP主成长排行榜(B站平台)发布
2021-07-18 ROS笔记-基础和通讯







![[leetcode] balanced binary tree](/img/77/a37557295646010326dac024cf869a.jpg)
