当前位置:网站首页>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
边栏推荐
猜你喜欢
QT + msvc2017编译器
[想要访问若依后台]若依框架报错401请求访问:error认证失败,无法访问系统资源
轻量化Backbone VGNetG成就“不做选择,全都要”轻量化主干网络
Secondary network security competition C module MS17-010 batch scanning
一天学会JDBC04:ResultSet的用法
25.时间序列预测实战
最强分布式锁工具:Redisson
华为设备配置VRRP与路由联动监视上行链路
LLVM编译技术应用分析
解决:Hbuilder工具点击发行打包,一直报尚未完成社区身份验证,请点击链接xxxxx,项目xxx发布H5失败的错误。
随机推荐
unittest使用简述
Secondary network security competition C module MS17-010 batch scanning
form表单提交到数据库储存
【CNN基础】转置卷积学习笔记
安装GBase 8c数据库集群时,报错误码:80000306,显示Dcs cluster not healthy。怎么处理错误呢?
【UE虚幻引擎】UE5三步骤实现AI漫游与对话行为
unity2D横版游戏教程7-敌人AI死亡效果
MySQL group_concat()详解
JNI学习1.环境配置与简单函数实现
【selenium自动化】第四篇,结合testNg
GBase 8c中怎么查询数据库配置参数,例如datestyle。使用什么函数或者语法呢?
金仓数据库的单节点如何转集群?
【虚幻引擎UE】UE5基于Gltf加载插件实现gltf格式骨骼动画在线/本地导入和切换
分布式计算实验2 线程池
金仓数据库KingbaseES客户端编程接口指南-JDBC(8. JDBC 元数据处理)
js-第一个出现两次的字母
Yolov5更换主干网络之《旷视轻量化卷积神经网络ShuffleNetv2》
虚拟机没有USB网卡选项怎么解决
轻量化Backbone VGNetG成就“不做选择,全都要”轻量化主干网络
QT + msvc2017编译器