Chapter 03Lesson 01~115 minutes

Test Plan Tree, Scope, Execution Order, and Component Semantics: Core Concepts and Mental Model

JMeter's tree is not merely a GUI outline. It is the execution architecture that determines which requests run, which hierarchical elements apply to them, which variables are available, when a SampleResult can be inspected, and which listeners receive the evidence.

Tree semanticsScopeExecution orderSampleResultListeners

Learning objectives

  • Separate primarily ordered elements—controllers and samplers—from hierarchical/scoped elements.
  • Explain the documented per-sampler execution order without relying on visual top-to-bottom intuition.
  • Determine scope by walking from a sampler through its ancestor branches.
  • Distinguish configuration, pre-processing, timers, sampling, post-processing, assertions, and listener observation.
  • Relate thread-local variables and SampleResults to the sampler that produced them.
  • Recognize how mis-scoped elements weaken reviewability and performance evidence.

1. Why Chapter 03 exists

Chapter 01 defined the experiment contract. Chapter 02 made the Java/JMeter toolchain and JMX artifact reproducible. That still is not enough: a perfectly pinned JMX can execute the wrong behavior if a timer, assertion, header, extractor, or listener is attached at the wrong level.

Executable boundary: every runnable Chapter 03 example targets only http://127.0.0.1:8000. Scope debugging uses one thread and one iteration. Moving a tree element is never permission to increase traffic or redirect the plan to an uncontrolled target.

2. The tree has two dimensions: order and hierarchy

JMeter documents controllers and samplers as primarily ordered. A thread walks them according to controller logic and tree order. Listeners, Configuration Elements, Pre-Processors, Post-Processors, Assertions, and Timers are primarily hierarchical: their placement defines which sampler descendants they affect.

So “the timer is visually below Beta, therefore it runs after Beta” is false. If that timer is in Beta's scope, the timer phase executes before Beta.

3. Mental model: choose sampler, collect scope, execute phases

Ordered samplers with hierarchical support elements

Read the arrows as execution and scope relationships, not decorative visual ordering.

flowchart TD
TP[Test Plan] --> TG[Thread Group]
TG --> LC[Logic Controller]
LC --> S1[Sampler Alpha]
LC --> S2[Sampler Beta]
LC -. scope .-> C[Configuration]
LC -. scope .-> PR[Pre-Processors]
LC -. scope .-> T[Timers]
LC -. scope .-> PO[Post-Processors]
LC -. scope .-> A[Assertions]
TG -. scope .-> L[Listener]
S1 --> O1[Config → Pre → Timers → Alpha → Post → Assert → Listen]
S2 --> O2[Config → Pre → Timers → Beta → Post → Assert → Listen]

Controller logic first determines the next sampler. JMeter then gathers applicable hierarchical elements and processes them by type. The current manual gives this order: Configuration Elements, Pre-Processors, Timers, Sampler, Post-Processors, Assertions, then Listeners. Within a single element type, applicable elements follow their tree order.

Type phase outranks visual intermixing. A Post-Processor drawn above a sampler still runs after that sampler when it is in scope.

4. Scope: walk upward from the sampler

Start at the sampler and walk up its ancestors. At each branch, collect applicable hierarchical elements. A child element under Alpha is narrow and affects Alpha; the same element under Alpha and Beta's parent controller affects both descendants.

Placement Typical scope Example
Child of Sampler Alpha Alpha only One Response Assertion validates only Alpha.
Child of Simple Controller Applicable sampler descendants One Constant Timer delays Alpha and Beta.
Child of Thread Group Applicable samplers throughout that group One listener can collect results from the group.
Child of Test Plan Element-dependent broad scope Broad placement should be deliberate and reviewable.

5. Component semantics in the lifecycle

Element Purpose Network request? Key state
Test Plan Root project configuration No Plan structure/startup values.
Thread Group Creates/schedules worker threads No Thread lifecycle and per-thread variable copies.
Logic Controller Chooses/orders/repeats child work Usually no Control flow; some controllers generate synthetic SampleResults.
Sampler Performs protocol/client work Usually yes for protocol samplers Produces a SampleResult.
Configuration Element Supplies/modifies sampler configuration Normally no Defaults/managers in hierarchical scope.
Pre-Processor Changes state before an applicable sampler No Variables/sampler configuration.
Timer Delays before an applicable sampler No Think-time/pacing contribution.
Post-Processor Processes a completed SampleResult No Extraction and derived thread variables.
Assertion Evaluates correctness No Can mark a sample failed.
Listener Consumes sample events No Display/file/aggregate observation.

6. Timer placement changes scheduling, not server response time

A timer runs before each sampler in scope. Multiple applicable timers are summed. The intentional wait therefore should not be interpreted as target latency. To observe timer effects, inspect sample start timestamps, iteration duration, or achieved throughput in addition to sampler elapsed.

7. SampleResult lifecycle: extraction before assertion observation

A protocol sampler creates a SampleResult containing client-side timing, success state, response code/message, response data metadata, bytes, and other fields. Post-Processors then can extract values from that result into thread-local variables. Assertions evaluate correctness and can change the result to failed. Listeners receive the emitted result after those phases.

This gives a common causal chain: response → extractor → thread variable → assertion/result → listener/JTL evidence.

8. Variables are thread-local; scope controls when they change

JMeter variables are local to each thread. If an extractor applies to Alpha only, Beta does not refresh it. If the extractor applies to both, whichever applicable sampler executes last may leave the final value seen by a later Debug Sampler.

User Defined Variables are a special case: the manual says they are processed at test start regardless of visual position. Put them clearly near the start of a Thread Group instead of relying on a misleading location.

9. Configuration managers do not share one universal merge rule

Current HTTP Header Manager documentation explicitly supports multiple Header Managers and merges header entries, with a later matching header replacing an earlier value. Other managers have different semantics. Prefer one clearly owned manager per concern and narrow, named overrides only when needed.

10. Listener scope and listener cost are different questions

Listeners collect results from elements at or below their level. View Results Tree is excellent at one thread × one loop because it exposes request/response and Debug Sampler data. It is not a load-mode strategy: detailed GUI rendering and retention consume generator resources. Use CLI JTL plus jmeter.log for load evidence.

11. Read-only inspection before moving an element

  • Save the current JMX and record its path/version-control state.
  • Mark controller/sampler execution order.
  • For each hierarchical element, list sampler descendants.
  • Record current variables/defaults/properties.
  • Record listener placement and whether it is debug-only.
  • Predict affected samplers before dragging anything.

12. Why this matters in DevOps

Performance plans are reviewed like code. Reviewers need to explain which requests run, which defaults/headers reach them, which waits shape them, what assertions define correctness, what data gets extracted, and what artifacts receive the outcome. Tree semantics make that architecture explicit and reproducible.

Knowledge check

A Constant Timer is visually below Beta but is a sibling of Alpha and Beta. Does it run after Beta?

How do you determine whether an assertion applies to a sampler?

What must exist before a Post-Processor can extract a response value?

Why can Debug Sampler show a different variable after moving an extractor?

Why is View Results Tree inappropriate for real load?

Next lesson

Move one element, predict one effect

Lesson 2 builds a loopback Alpha/Beta plan and moves Header Manager, Timer, Assertion, and Post-Processor between broad and narrow scopes while checking target headers, variables, timestamps, failures, JTL, and engine logs.

Official references and version notes

  • Elements of a Test Plan — execution order, scoping rules, variables/properties, timers, assertions, configuration elements, processors, listeners, controllers, and samplers.
  • Component Reference — Header Manager, Constant Timer, Response Assertion, Regular Expression Extractor, Debug Sampler, Transaction Controller, and listeners.
  • Functions and Variables — sampler-context functions and variable semantics.
  • Hints and Tips — current quick-add bindings for common debug elements.
  • Getting Started and Best Practices — GUI authoring versus CLI load execution and lean result collection.
  • Apache JMeter downloads — current production release and Java requirement.
Version and compatibility note

Version-sensitive statements were rechecked against current Apache JMeter primary documentation on 2026-09-04. The baseline is Apache JMeter 5.6.3 with a Java 17 JDK for labs and no third-party plugins; JMeter 5.6.3 itself requires Java 8+. The current Test Plan manual defines applicable execution order as Configuration Elements → Pre-Processors → Timers → Sampler → Post-Processors → Assertions → Listeners. Controllers and samplers are primarily ordered; listeners, configuration elements, pre/post-processors, assertions, and timers are hierarchical/scoped. Mandatory traffic is restricted to http://127.0.0.1:8000, one thread and one loop. Debug Sampler/View Results Tree are bounded GUI diagnostics only; CLI remains the load-evidence path.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.