Using Response Assertion
JMeter comes bundled with assertion components. Assertions are used to perform additional checks on samplers and are processed by default after every sampler in the same scope, except for in cases where they have been added as a direct child of a sampler. You can think of these as mini unit tests within your test plans that ensure the responses from the server actually work fine. For example, when you make HTTP requests in a web application, the server responses may respond with different HTTP header status codes, denoting the success or failure of your request. A status code of 200
, for example, means the request succeeded, 401
means access was denied to the requested resource, 500
means an internal server error occurred while attempting to fulfill your request, and so on.
How to do it…
In this recipe, we will cover how to use JMeter's Response Assertion to provide our test scripts with additional checks, thus making them more robust. Perform the following steps:
Launch...