当前位置:网站首页>Software testing -- common assertions of JMeter interface testing
Software testing -- common assertions of JMeter interface testing
2022-07-07 02:42:00 【Xiaowu knock code】
In the interface test , We need to check whether the request processing result is correct . When the response status code of the request is 200, Is the function of the time table interface normal ? It's obviously not true .
The response status is 200, It can only indicate that the service has processed your request , At the same time, the result is returned ; However, it does not mean that the processing result meets the functional requirements of the interface .
There is only further inspection at this time “ The response data ” Whether it is consistent with that in the interface description ; To determine whether the result is correct .
Jmeter Provides an assertion element , The implementation checks whether the response data in the interface test meets the expectation , Ensure that the interface test is consistent with the expectation .
notes : The content of this article is based on “Jmeter Quickly create interface test scripts ” Request as an example .
1、 Response assertion
Apply to : Judge the comparison between the returned content and the expected result
step : Where judgment is needed “HTTP” Request interface , Right click “ add to ”\“ Assertion ”\“ Response assertion ”.
for example , The response text contains “ nanjing ”, Indicates that the request response was successful .
stay “ Test mode ” Add “ nanjing ”, Click on “ start-up ” Icon , Perform the requested , View the result tree . Maybe it's strange to have friends here , How is it consistent with the execution effect without assertion .
Then revise it again “ Response assertion ” by “ Nanjing I love you ”, Execute the request again .
When the request result is a red table, the request execution result is different from the expected setting , Not included “ Nanjing I love you ” character , Prove that the execution of this interface use case failed .
Following pair “ Response assertion ” Introduce the content in detail .
APPly to:
Main sample and sub-samples: It acts on the main sampler and the corresponding sub sampler
Main sample only: Only works on the main sampler
Sub-samples only: Only works on sub samplers
JMeter Variable: Act on jmeter Variable ( Enter... In the input box jmeter The variable name of )
Test fields : The response text 、 Response code 、 Response information 、 Response head …
Pattern matching rules : Include 、 matching 、Equals、 character string 、 no 、 perhaps
Test mode : You can add / Delete the content to be judged , Button “ add to ”、“ Delete ” Manage the specified content .
In addition to response assertions , There are other assertions .
2、 Size assertion
Apply to : Determine the size of the returned content .
step : Where judgment is needed “HTTP” Request interface , Right click “ add to ”\“ Assertion ”\“ Size assertion ”.
APPly to: Same as “ Response assertion ”
Response Size Field to Test( Test scope of response field ): Complete response 、 Response head 、 The message body of the response 、 Response code 、 Response information .
Size to Assert: Assertion byte size
The response field can be seen by viewing the result tree
Set the assertion value according to the size of the returned response message body , Generally, what is larger than how many bytes , Do not use =, Because the data is changing , Most will be within a certain range .
3、 Assertion duration
Apply to : Determine the response time of the request
step : Where judgment is needed “HTTP” Request interface , Right click “ add to ”\“ Assertion ”\“ Assertion duration ”.
APPly to: Same as “ Response assertion ”
The duration of the ( millisecond ): Set the time of the period , For example, predict 3 Second response , It is set to 3000, If the response time is 3 Seconds back to , Then it asserts success , Otherwise failure !
Finally, thank everyone who reads my article carefully , The following online link is also a very comprehensive one that I spent a few days sorting out , I hope it can also help you in need !
These materials , For those who want to change careers 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful ……
If you don't want to grow up alone , Unable to find the information of the system , The problem is not helped , If you insist on giving up after a few days , You can click the small card below to join our group , We can discuss and exchange , There will be various software testing materials and technical exchanges .
Click the small card at the end of the document to receive it |
Typing is not easy , If this article is helpful to you , Click a like, collect a hide and pay attention , Give the author an encouragement . It's also convenient for you to find it quickly next time .
Self study recommendation B Stop video :
Zero basis transition software testing :25 Days from zero basis to software testing post , I finished today , Employment tomorrow .【 Include features / Interface / automation /python automated testing / performance / Test Development 】
Advanced automation testing :2022B The first station is super detailed python Practical course of automated software testing , Prepare for the golden, silver and four job hopping season , After advanced learning, it soared 20K
边栏推荐
- Here comes a white paper to uncover the technology behind Clickhouse, a node with 10000 bytes!
- The cities research center of New York University recruits master of science and postdoctoral students
- Integerset of PostgreSQL
- [Mori city] random talk on GIS data (II)
- A new path for enterprise mid Platform Construction -- low code platform
- 基于ensp防火墙双击热备二层网络规划与设计
- 数论 --- 快速幂、快速幂求逆元
- Pgadmin4 of PostgreSQL graphical interface tool
- 写作系列之contribution
- Huitong programming introductory course - 2A breakthrough
猜你喜欢
Increase 900w+ playback in 1 month! Summarize 2 new trends of top flow qiafan in station B
测试优惠券要怎么写测试用例?
Douban average 9 x. Five God books in the distributed field!
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Niuke programming problem -- double pointer of 101 must be brushed
Pioneer of Web3: virtual human
NuScenes数据集关于Radar数据的统计
Matlb| economic scheduling with energy storage, opportunity constraints and robust optimization
Apifox, is your API interface document rolled up like this?
leetcode:5. Longest palindrome substring [DP + holding the tail of timeout]
随机推荐
The so-called consumer Internet only matches and connects industry information, and does not change the industry itself
阿里云易立:云原生如何破解企业降本提效难题?
unity中跟随鼠标浮动的面板,并可以自适应文字内容的大小
AWS learning notes (I)
Leetcode:minimum_depth_of_binary_tree解决问题的方法
基于ensp防火墙双击热备二层网络规划与设计
导数、偏导数、方向导数
PostgreSQL图形化界面工具之pgAdmin4
QT common Concepts-1
The panel floating with the mouse in unity can adapt to the size of text content
ODBC database connection of MFC windows programming [147] (with source code)
Compress JS code with terser
企业中台建设新路径——低代码平台
postgresql之integerset
1 -- Xintang nuc980 nuc980 porting uboot, starting from external mx25l
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Difference and the difference between array and array structure and linked list
Go swagger use
MMDetection3D加载毫米波雷达数据
Halcon instance to opencvsharp (C openCV) implementation -- bottle mouth defect detection (with source code)