JMeter Execution Order and Scoping Rules

Welcome to Learn JMeter Series! This series helps you to learn Apache JMeter in a much simpler way with the relevant examples and exercises. This tutorial focuses on JMeter Execution Order and Scoping Rules.

Why you should know about Execution Order and Scoping Rules?

Consider a simple test plan as shown below. By default, JMeter executes sequentially when it comes to Samplers and Logic Controller by the order they appear in the test plan. But when it comes to other elements, JMeter follow certain execution order.

To remember the execution order, use the acronym CONF-PTS-PAL.

  • Configuration elements
  • Pre-Processors
  • Timers
  • Sampler
  • Post-Processors (unless SampleResult is null)
  • Assertions (unless SampleResult is null)
  • Listeners (unless SampleResult is null)

When you click on Run button for the above test plan, first JMeter will look for any configuration elements are present or not. If it finds, those will be executed first.

Then it looks for any Pre Processors and then Timers. If there are more timers added to the Thread Group, it will be summed up and gets executed.

Then JMeter executes Samplers in the order which they appear.

Then Post Processors, Assertions and at last Listeners.

In the above test plan, the execution order would be:

  • Config Elements in the order they appear
  • Uniform Random Timer
  • T00_HomePage
  • Response Assertion
  • Uniform Random Timer
  • T10_TopCommand
  • Response Assertion
  • Listeners in the order they appear

Suppose if you are unsure about the execution order, you will end up in having elements in the incorrect place or the order. Particularly Timers, timers always gets executed before the sampler. If you are keeping timers wherever you like, you will not achieve the expected throughput while load testing.

JMeter Execution Order and Scoping Rules
JMeter Execution Order and Scoping Rules

How to know the execution order?

By changing the log level to ALL in JMeter, it is possible to analyze the execution order. Go to Options > Log Level > ALL. Then click on Options > Log Viewer. Turning the log level to ALL is recommended only for debugging purpose. By scanning the logs, you could come to conclusion about the execution order.

Scoping Rules

Scoping rules in JMeter are both hierarchical and ordered. In the below test plan, there is a timer for the sampler T00_HomePage and an assertion for T10_TopCommand. The timer has the scope only for the T00_HomePage sampler and assertion has the scope for the T10_TopCommand sampler. Scoping rules can be identified using the parent-child relationship for each element.

Tip: The Configuration elements Header Manager, Cookie Manager and Authorization manager are treated differently from the Configuration Default elements. The settings from the Configuration Default elements are merged into a set of values that the Sampler has access to.

Figure the execution order and scoping rules for this simple test plan.

Exercise
Exercise

About the Author

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link