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

JMeter Complete Element Reference– Part VI

In this article, we will discuss about the next set of JMeter elements i.e Pre-Processors and Post-Processors. Lets discuss in detail, how do we use these elements to build a effective test scripts . In case if you have missed the older articles click here.

Pre Processor Elements

A Pre-Processor elements executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren’t extracted from response text.

Post Processor Elements

A Post-Processor elements executes some action after a Sampler Request has been made. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs. A Post-Processor is most often used to process the response data, often to extract values from it.

Execution order of the Elements:

Lets understand in which order JMeter process the elements when multiple elements are added to the thread group.

  1. Configuration elements
  2. Pre-Processors
  3. Timers
  4. Sampler
  5. Post-Processors
  6. Assertions
  7. Listeners

Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply. Logic Controllers and Samplers are processed in the order in which they appear in the tree. Other test elements are processed according to the scope in which they are found, and the type of test element.

Continue reading JMeter Complete Element Reference– Part VI