JMeter Complete Element Reference – Part VII

In this article, I will talk you through about the next set of JMeter elements i.e Assertions. These elements plays a crucial role in validating samplers in our test scripts. Lets discuss in detail about the advantages and disadvantages in using assertions. In case if you have missed the older articles click here.

Assertions

From the previous posts, we are all aware that how to send requests and get response from the target server. Now you may have many questions running in your mind like are we receiving expected or desired response from the server, how can we validate the received response  through JMeter. In this case, Assertions come to your rescue !!

Assertions are used to perform additional checks on samplers, and are processed after every sampler in the same scope. To ensure that an Assertion is applied only to a particular sampler, add it as a child of the sampler. By default assertions can be applied only to main samples but JMeter also provides an options to include  assertions only to sub-samples or both. Scope of the assertions can be as follows:

Assertions

If a sub-sampler fails and the main sample is successful, then the main sample will be set to failed status and an Assertion Result will be added. If the JMeter variable option is used, it is assumed to relate to the main sample, and any failure will be applied to the main sample only. More than one assertion can be added to the sampler, controller, thread group or test plan. Failed assertions will cause all affected samples to fail.

Continue reading JMeter Complete Element Reference – Part VII

Advertisements