Assertion in JMeter
Pavithra M
Data Analyst | SQL | Excel | Power BI | Tableau | Python | R | Data Engineer | SEO Expert | Social Media Marketing | Content Writer | Link Building | Campaigns | SEO Team Lead | Analytics and Reporting
Assertion in JMeter is used to validate response of the request, that you have sent to the server. Assertion is a process where you verify expected result with the actual result of the request at run time. If you need to apply assertion on a particular Sampler, then add it as a child of that Sampler.
Why do we need assertions?
Assertions are needed in performance test scripts to validate that the response received from server is correct and is not affected by increasing the load on the server.
The assertions are also helpful in doing functional testing of different kinds of applications by comparing the actual and expected output.
JMeter Assertions are a must have to perform additional checks on the result of a Sampler. Assertions are part of the Post-Processors elements family.
Assertion Scope defines to which sample results the assertion applies to:
·???????Main Sample only: applies only on the result of a sampler (in most of the cases an HTTP Request),
·???????Main Sample and sub-samples: some samplers can generate sub-samples. For example, It happens when enabling Retrieve All Embedded Resources on HTTP Request samplers. A sub-sample result is generated per resource (CSS, Images, Javascript etc…),
·???????Sub-Samples Only: apply to sub-sample results only,
·???????JMeter Variable: apply the assertion on the value of a variable (like ${foo}).
In most situations, you will want to use the Main Sample Only option. Assertions can rarely be applied on both the main result and sub-results.
List of Assertions are as follows:
BeanShell Assertion
BSF Assertion
领英推荐
Compare Assertion
Duration Assertion
HTML Assertion
JSR223 Assertion
MD5Hex Assertion
Response Assertion
Size Assertion
SMIME Assertion
XML Assertion
XML Schema Assertion
XPath Assertion
Learn More JMeter
If you are new to JMeter, and you’d like to learn more, please check here free online JMeter training course.
?