当前位置:网站首页>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 !
边栏推荐
- 字符串0123456789abcdef,子串(非空且非同串本身)的个数是多少【杭州多测师】【杭州多测师_王sir】...
- 【sylar】框架篇-Chapter10-Address 模块
- 外卖系统 文件上传
- 低代码是开发的未来吗?浅谈低代码平台
- Comprehensively analyze the differences between steam and maker Education
- Use and expansion of fault tolerance and fusing
- [Sylar] framework chapter -chapter21- environment variable module
- Nat fundamentals and private IP
- 【sylar】框架篇-Chapter21-环境变量模块
- Wang Shuang assembly language detailed learning notes 3: registers (memory access)
猜你喜欢

How to upgrade a pair of 12.2 RAC(primary) and a pair of 12.2 RAC(dataguard) to 19c

全方位分析STEAM和创客教育的差异化

Easycvr Video Square snapshot adding device channel offline reason display

Domain name (subdomain name) collection method of Web penetration

Analysis of the reason why easycvr service can't be started and tips for dealing with easy disk space filling

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

Introduction to this pointer

MySQL数据库————初识数据库

C语言ATM自动取款机系统项目的设计与开发

Wang Shuang assembly language detailed learning notes 3: registers (memory access)
随机推荐
Interview fraud: there are companies that make money from interviews
CMake使用基础汇总
Inspire domestic students to learn robot programming education for children
【sylar】框架篇-Chapter7-IO 协程调度模块
[Sylar] framework chapter -chapter10-address module
String 0123456789abcdef, what is the number of substrings (not empty and not the same string itself) [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
Rendering process, how the code becomes a page (2)
Use animatedbuilder to separate components and animation, and realize dynamic reuse
Transformer landing | next vit realizes the real-time landing of industrial tensorrt, surpassing RESNET and cswin
[Sylar] framework -chapter9-hook module
Phpstorm2022 connect to the database
数据库故障容错之系统时钟故障
Explain initialization list
【sylar】框架篇-Chapter23-模块篇总结
CPU and memory usage are too high. How to modify RTSP round robin detection parameters to reduce server consumption?
MySQL: data types and operators
【sylar】框架篇-Chapter9-hook 模块
Tiantian AMADA CNC bending machine touch screen maintenance rgm21003 host circuit board maintenance
全方位分析STEAM和创客教育的差异化
Alibaba interview question [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]