当前位置:网站首页>Do you know several assertion methods commonly used by JMeter?
Do you know several assertion methods commonly used by JMeter?
2022-07-28 04:49:00 【Software testing Intelligence Agency】
In the use of Jmeter Conduct performance test or interface automation test , A function often used , It's an assertion . Assertion is to add a layer of judgment mechanism at the return level of the request . Because the request was successful , It doesn't mean the results are right , Therefore, we need a judgment mechanism to improve the accuracy of testing . this paper This paper mainly introduces 3 Common assertions : Response assertion 、JSON Assertion 、 Assertion duration .
►►► One 、 Response assertion (Response Assertion)
Response assertion is the most commonly used assertion method , It mainly asserts the text content in the response result , For example, 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 study
Send a request :
https://lemon.ke.qq.com/?tuin=203e4d43
– Official website interface
Assertion checking : Check whether the response result contains “ Lemon class software testing ” Text content of
2 Operation steps
The first 1 Step : Add thread group
The first 2 Step : add to HTTP request

The first 3 Step : stay HTTP Add response assertion under request

The first 4 Step : Add assertion results and add view result tree
The first 5 Step : After running the interface , Look at the assertion result and look at the result tree


►►► Two 、JSON Assertion
JSON Assertion is also an assertion method often used in testing , It is generally used to assert whether a field value is equal to the value we specify . therefore JSON Assertions can only be made against responses that result in applicaton/json Assert in the format . If it's another type ( Such as :Test、html), You cannot use this method .
1 Case study
Send a request :
http://47.115.15.198:7001/smarthome/user/login
– Login interface
Assertion checking : Check the data in the response ,user_name Whether the content corresponding to the node is "lemonn"
2 Operation steps
The first 1 Step : Add thread group
The first 2 Step : add to HTTP request

The first 3 Step : stay HTTP Add response assertion under request

The first 4 Step : Add assertion results and add view result tree
The first 5 Step : After running the interface , Look at the assertion result and look at the result tree


►►► 3、 ... and 、 Assertion duration
(Duration Assertion)
Assertion duration is usually used for performance testing , Generally used to check HTTP Whether the response time of the request exceeds the expected value . And this response time is a performance index that is often concerned in performance testing .
1 Case study
Send a request :https://www.baidu.com/
– Baidu official website interface
Assertion checking : Check that the response time is less than 200ms
2 Operation steps
The first 1 Step : Add thread group
The first 2 Step : add to HTTP request

The first 3 Step : stay HTTP Add response assertion under request

The first 4 Step : Add assertion results and add view result tree
The first 5 Step : After running the interface , Look at the assertion result and look at the result tree


Last : It can be in the official account : Sad spicy bar ! Get one by yourself 216 Page software testing engineer interview guide document information 【 Free of charge 】. And the corresponding video learning tutorial is free to share !, It includes basic knowledge 、Linux necessary 、Shell、 The principles of the Internet 、Mysql database 、 Special topic of bag capturing tools 、 Interface testing tool 、 Test advanced -Python Programming 、Web automated testing 、APP automated testing 、 Interface automation testing 、 Testing advanced continuous integration 、 Test architecture development test framework 、 Performance testing 、 Safety test, etc. .
I recommend one 【Python Automated test communication group :746506216】, We can discuss communication software testing together , Learn software testing together 、 Interview and other aspects of software testing , Help you advance quickly Python automated testing / Test Development , On the road to high pay .
Friends who like software testing , If my blog helps you 、 If you like my blog content , please “ give the thumbs-up ” “ Comment on ” “ Collection ” One Key triple connection !
边栏推荐
- 05.01 string
- MySQL partition table transformation
- Installing MySQL under Linux
- pytorch_ Lightning in lightning_ The output of hparams.yaml in logs is null
- Cloudcompare & PCL point cloud least square fitting plane
- 机器人教育在STEM课程中的设计研究
- 外卖系统 文件上传
- [Sylar] framework -chapter9-hook module
- Explain initialization list
- MySQL数据库————初识数据库
猜你喜欢

Comprehensively analyze the differences between steam and maker Education

Dynamic SQL and paging
![(manual) [sqli labs27, 27a] error echo, Boolean blind injection, filtered injection](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
(manual) [sqli labs27, 27a] error echo, Boolean blind injection, filtered injection

(clone virtual machine steps)

Rendering process, how the code becomes a page (2)

动态sql和分页

031 log4j log framework
![String 0123456789abcdef, what is the number of substrings (not empty and not the same string itself) [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]](/img/78/efe3d70a4bfe8ac0c9b58b54d02b00.png)
String 0123456789abcdef, what is the number of substrings (not empty and not the same string itself) [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
![[daily question 1] 735. Planetary collision](/img/ba/0ef08ff874f1ddad3fa79b01dba61f.png)
[daily question 1] 735. Planetary collision

Constructor of member function
随机推荐
Use animatedbuilder to separate components and animation, and realize dynamic reuse
[Sylar] framework Chapter 6 collaborative scheduling module
Cmake usage base summary
数据库故障容错之系统时钟故障
Machine learning and deep learning -- normalization processing
What is the reason why the easycvr national standard protocol access equipment is online but the channel is not online?
Design and development of C language ATM system project
Transformer landing | next vit realizes the real-time landing of industrial tensorrt, surpassing RESNET and cswin
Gerrit operation - rollback a patch_ set
【sylar】实战篇-基于 redis 的参数查询服务
set与list性能对比
What SaaS architecture design do you need to know?
【sylar】框架篇-Chapter23-模块篇总结
Rendering process, how the code becomes a page (2)
Web渗透之域名(子域名)收集方法
Youxuan database participated in the compilation of the Research Report on database development (2022) of the China Academy of communications and communications
Observable time series data downsampling practice in Prometheus
[每日一氵]上古年代的 Visual Studio2015 安装
【sylar】框架篇-Chapter20-守护进程模块
[function document] torch Histc and paddle Histogram and numpy.histogram