当前位置:网站首页>How many assertion methods are commonly used in JMeter?
How many assertion methods are commonly used in JMeter?
2022-08-04 08:02:00 【Program Yuanyuexia】
A feature that is often used in performance testing or interface automation testing using Jmeter is assertion.Assertion is to add a layer of judgment mechanism to the return level of the request.Because the request is successful, it does not mean that the result is necessarily correct, so a judgment mechanism is needed to improve the accuracy of the test.This article mainly introduces three commonly used assertions: response assertion, JSON assertion, and assertion duration.
1. Response Assertion
Response assertion is the most commonly used assertion method. It mainly asserts the text content in the response result, such as whether the response result contains the specified value, or whether it is equal to the specified value.Response assertions can be applied to response results of various return types, such as Test, html, application/json, application/xml, etc.
1: Case
Send request:
Assertion Check: Check whether the response result contains the text content of "Lemon Class Software Test"
2: Operation steps
Step 1: Add a thread group
Step 2: Add HTTP Request

Step 3: Add response assertion under HTTP request

Step 4: Add Assertion Results and Add View Results Tree
Step 5: After running the interface, view the assertion result and view the result tree


Second, JSON assertion
JSON assertion is also an assertion method often used in testing work. It is generally used to assert whether a field value is equal to the value we specify.Therefore, JSON assertion can only be asserted for the response result in applicaton/json format.If it is other types (such as: Test, html), this method cannot be used.
1: Case
Send request: http://47.115.15.198:7001/smarthome/login --login interface
Assertion check: Check whether the content corresponding to the user_name node in the response data is "lemonn"
2: Operation steps
Step 1: Add a thread group
Step 2: Add HTTP Request

Step 3: Add response assertion under HTTP request

Step 4: Add Assertion Results and Add View Results Tree
Step 5: After running the interface, view the assertion result and view the result tree


Three. Duration Assertion
Assertion duration is usually used for performance testing, generally used to check whether the response time of HTTP requests exceeds the expected value.And this response time is a performance indicator that is often concerned in performance testing.
1: Case
Send request: https://www.baidu.com/ --Baidu official website interface
Assertion Check: Check if the response time is less than 200ms
2: Procedure
Step 1: Add a thread group
Step 2: Add HTTP Request

Add image comment, no more than 140 characters (optional)
Step 3: Add response assertion under HTTP request

Step 4: Add Assertion Results and Add View Results Tree
Step 5: After running the interface, view the assertion result and view the result tree


Jmeter's assertion method, do you know it?Below is some test data, free to share

边栏推荐
- 高等代数_证明_对称矩阵属于不同特征值的特征向量正交
- inject() can only be used inside setup() or functional components.
- unity2D横版游戏教程7-敌人AI死亡效果
- 24.循环神经网络RNN
- [Paper Notes] - Low Illumination Image Enhancement - Supervised - RetinexNet - 2018-BMVC
- Redis非关系型数据库
- 金仓数据库KingbaseES客户端编程接口指南-JDBC(6. JDBC 大对象数据处理)
- Distributed Computing Experiment 2 Thread Pool
- 金仓数据库KingbaseES客户端编程接口指南-JDBC(10. JDBC 读写分离最佳实践)
- 全国职业院校技能大赛网络安全竞赛之应急响应
猜你喜欢

轻量化Backbone VGNetG成就“不做选择,全都要”轻量化主干网络

GIS数据与CAD数据间带属性字段互相转换还原工具,解决ArcGIS等软件进行GIS数据转CAD数据无法保留属性字段问题

研究性学习专题 3_LL(1)语法分析设计原理与实现

C语言指针

沃尔玛、阿里国际该如何做测评自养号?

Secondary network security competition C module MS17-010 batch scanning

经典二分法查找的进阶题目——LeetCode33 搜索旋转排序数组

「PHP基础知识」转换数据类型

C语言strchr()函数以及strstr()函数的实现

【UE虚幻引擎】UE5实现动态导航样条线绘制
随机推荐
新特性解读 | MySQL 8.0 在线调整 REDO
IDEA引入类报错:“The file size (2.59 MB) exceeds the configured limit (2.56MB)
解决循环依赖import cycle not allowed的最佳解决办法
【电脑录制屏】如何使用bandicam录游戏 设置图文教程
无人驾驶运用了什么技术,无人驾驶技术是
【JS 逆向百例】某网站加速乐 Cookie 混淆逆向详解
为什么手动启动GBase 8c数据库中GTM节点,起不来。显示“Run cmd failed:scp: /tmp/gtm_gtm1.server: Permission denied”
LeetCode 97. 交错字符串
redis stream 实现消息队列
ShuffleNet v2网络结构复现(Pytorch版)
尚医通【预约挂号系统】总结
玩转TypeScript对象、对象作为参数进行函数传递、接口和内置对象[无敌态]
Typora_Markdown_图片标题(题注)
【论文笔记】—低照度图像增强—Supervised—RetinexNet—2018-BMVC
powershell和cmd对比
GBase 8c中怎么查询数据库配置参数,例如datestyle。使用什么函数或者语法呢?
【CNN基础】转置卷积学习笔记
函数柯里化详解
此时已莺飞草长,愿世间美好与你环环相扣
金仓数据库KingbaseES客户端编程接口指南-JDBC(7. JDBC事务处理)