当前位置:网站首页>Explanation of assertions in JMeter
Explanation of assertions in JMeter
2022-06-25 08:56:00 【fish_ study_ csdn】
One 、JMeter Assertion
1.1 The concept of assertion
Assertion : Let the program judge whether the expected results are consistent with the world results
Tips :JMeter 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, detection mechanism is needed to improve the accuracy of testing
1.2 JMeter Common assertions in
(1) Response assertion
(2)JSON Assertion
(3) Duration assertion (Duration Assertion)
Two 、 Response assertion
How to add : test plan --> Thread group -->HTTP request -->( Right click to add ) Assertion --> Response assertion
To configure :
(1) Test fields : Fields to check

2) Pattern matching rules : What rules need to be used to check : Regular 、 And 、 or 、 Not 、 be equal to
| Test fields | |
| The response text | Keywords in the response body |
| Response code | Response code ,200 |
| Response information | The information returned after the response code ,OK |
| Response Headers | When testing the protocol, use , This is not used by general testing businesses |
| Request Headers | |
| URL sample | Content sent out , Generally, it is not checked , It all depends on the content of the response |
| Document(text) | Check text Formatted text |
| Ignore Status | Test the abnormal scenario , Determine the state of the wrong response , The result is not marked red |
| Request Data | |
Include | Regular |
| matching | Regular |
| be equal to Equals | |
| contain Substring | no 、 perhaps 、 And |
(3) Test mode : Value to be verified , You can fill in multiple values for comparison
Such as : request :https://www.baidu.com
Check : Let the program check whether the response data contains “ Baidu once , You will know ”
Operation steps :
(1) Add thread group
(2) add to HTTP request
(3) Add response assertion :HTTP request --> add to --> Assertion --> Response assertion 
(4) Add assertion results : Thread group --> add to --> Monitor --> assertion results

(5) Add view result tree
3、 ... and 、JSON Assertion
This component is used to JSON Document validation , The verification steps are as follows :
1. First analysis JSON data , If the data is not JSON, The verification fails
2. Use Jayway JsonPath 1.2.0 Search the specified path using the syntax in . If you can't find the path , Will fail
3. If found in the document JSON route , And it is required to verify the expected value , Then it will perform the verification operation
Mode of operation : test plan --> Thread group -->HTTP request -->( Right click to add ) Assertion -->JSON Assertion
Operation steps
1. Add thread group
2. add to HTTP request
3. add to JSON Assertion
Apply to HTTP The response is a JSON Format
To configure :
(1)JSON PATH:$.msg
(2) Check “Additional assert value”
(3)expected value Fill in The query is successful

4. Add assertion results
5. Add view result tree ( A mistake and a success )

边栏推荐
- Fault: 0x800ccc1a error when outlook sends and receives mail
- LVS-DR模式单网段案例
- Check whether the point is within the polygon
- Easyplayer streaming media player plays HLS video. Technical optimization of slow starting speed
- C language: count the number of words in a paragraph
- Oracle-单行函数大全
- Advanced technology Er, meet internship position information
- Jmeter中的断言使用讲解
- Summary of hardfault problem in RTOS multithreading
- socket编程——epoll模型
猜你喜欢
随机推荐
How safe is the new bond
RTOS 多线程下hardfault问题总结
How to become a software testing expert? From 3K to 17k a month, what have I done?
Cazy eight trigrams maze of Chang'an campaign
关掉一个线程
Trendmicro:apex one server tools folder
紧急行政中止令下达 Juul暂时可以继续在美国销售电子烟产品
2021 "Ai China" selection
从别人库里拷贝的游戏如何再自己的库里显示
Webgl Google prompt memory out of bounds (runtimeerror:memory access out of bounds, Firefox prompt index out of bounds)
Swiperefreshlayout+recyclerview failed to pull down troubleshooting
【515. 在每个树行中找最大值】
《乔布斯传》英文原著重点词汇笔记(五)【 chapter three 】
浏览器查看当前页面所有的监听事件
买股票通过客户经理的开户二维码开户资金是否安全?想开户炒股
Close a thread
How annotation lib and processor lib reference
Is it really safe to pay new debts? Is it risky
三、自动终止训练
打新债真的安全吗? 风险大吗









