JMeter – Assertion
Even though performance tests are classified as non-functional tests, getting the correct functional answer is always the main goal. Every performance test tool has a function to check the response from the server before returning a warning or an error if the check is unsuccessful. JMeter also features a unique element called “Assertion” which is used to validate responses against predetermined criteria. The sample passed or failed based on the validation result.
Assertion components essentially belong to the family of post processors because they are executed after receiving the response from the server and then comparing the expected and actual results.
The elements of an assertion have a defined scope. They can have a local or global impact depending on where they are added. The scope of an assertion becomes global, and all requests are validated if you include it as a child in a test plan. On the other hand, the response of that particular sample will only be approved if you add it in a sample.
Possible Parent element(s) of Assertion:
You can add an Assertion under following elements:
- Test Plan
- Thread Group
- Test Fragment
- Sampler
- Logic Controller
- Non-Test Element
List of JMeter’s assertion elements
- Response Assertion
- Duration Assertion
- Size Assertion
- XML Assertion
- BeanShell Assertion
- MD5Hex Assertion
- HTML Assertion
- XPath Assertion
- XPath2 Assertion
- XML Schema Assertion
- JSR223 Assertion
- Compare Assertion
- SMIME Assertion
- JSON Assertion
- JSON JMESPath Assertion