当前位置:网站首页>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
边栏推荐
猜你喜欢
Redis非关系型数据库
高等代数_证明_对称矩阵属于不同特征值的特征向量正交
Distributed Computing MapReduce | Spark Experiment
C语言指针
【电脑录制屏】如何使用bandicam录游戏 设置图文教程
Distributed Computing Experiment 1 Load Balancing
Cross-species regulatory sequence activity prediction
【UE虚幻引擎】UE5实现动态导航样条线绘制
MySQL BIGINT 数据类型
给Unity Behavior Designer(Unity行为树) 的Can See Object 画圆锥辅助图
随机推荐
MotionLayout的使用
MySQL 8.0.29 详细安装(windows zip版)
IntelliJ新建一个类或者包的快捷键是什么?
【JS 逆向百例】某网站加速乐 Cookie 混淆逆向详解
ContrstrainLayout的动画之ConstraintSet
使用单调栈解决接雨水问题——LeetCode 42 接雨水+单调栈说明
New Questions in Module B of Secondary Vocational Network Security Competition
RT-Thread Studio学习(十二)W25Q128(SPI)的读写
从零开始C语言精讲篇6:结构体
智能健身动作识别:PP-TinyPose打造AI虚拟健身教练!
安装GBase 8c数据库集群时,报错误码:80000306,显示Dcs cluster not healthy。怎么处理错误呢?
Lightweight Backbone VGNetG Achieves "No Choice, All" Lightweight Backbone Network
解决:Hbuilder工具点击发行打包,一直报尚未完成社区身份验证,请点击链接xxxxx,项目xxx发布H5失败的错误。
占位,稍后补上
使用腾讯云发送短信 ---- 手把手教你搞定所有步骤
Typora_Markdown_图片标题(题注)
将回调函数转为Flow
LeetCode 135. 分发糖果
int *p = &a、p = &a、*p = a的正确理解
沃尔玛、阿里国际该如何做测评自养号?