skip to content

Plan Composition

The structural rules that decide what a JMeter test plan is: which element families exist, where each one applies, in what order they run, and how a plan is stored and reused.

on this pageshow

explore

questions

26

In an Apache JMeter test plan, what are the element families and what does each one contribute?

level: juniorimportance: must knowfreq 76%

answer

  1. The Add menu is the taxonomy
  2. Eleven categories, not a loose list
  3. Minimum plan: plan, threads, sampler
  4. Two families the Test Plan node refuses

basics

~20 s

JMeter's Add menu groups elements into families: Threads (Users), Sampler, Logic Controller, Config Element, Timer, Pre Processors, Post Processors, Assertions, Listener, Test Fragment and Non-Test Elements. The family tells you what an element does around a sampler.

solid answer

~50 s

A JMeter plan is a tree whose every node belongs to one family, and the family is the element's job description. A **Thread Group** is where execution begins; the manual states that all controllers and samplers must sit under one. **Samplers** send a request and produce a sample result. **Logic Controllers** send nothing themselves and decide which of their children run, and how often. **Config Elements** do not send requests but add to or modify the ones samplers send. **Timers** pause before each sampler in their scope. **Assertions** judge a response and can turn a technically successful sample into a failed one. **Listeners** consume results and may hang anywhere, collecting only from elements at or below their level. **Pre-** and **Post-Processors** act around a sampler. **Test Fragments** and **Non-Test Elements** hold no load of their own.

code

text · 19 lines
text
Test Plan                                  <- plan-level settings + User Defined Variables
  HTTP(S) Test Script Recorder             <- Non-Test Elements (authoring tool, no load)
  setUp Thread Group                       <- Threads (Users), runs first, to completion
    JSR223 Sampler "seed accounts"         <- Sampler
  Thread Group "checkout"                  <- Threads (Users), the measured work
    HTTP Request Defaults                  <- Config Element (modifies requests)
    HTTP Cookie Manager                    <- Config Element
    Constant Timer                         <- Timer (pauses before each sampler in scope)
    Once Only Controller                   <- Logic Controller
      HTTP Request "login"                 <- Sampler
    Transaction Controller "checkout"      <- Logic Controller (also emits a sample)
      HTTP Request "cart"                  <- Sampler
        Response Assertion                 <- Assertion (can fail a 200)
        JSON Extractor                     <- Post Processor
      HTTP Request "pay"                   <- Sampler
  tearDown Thread Group                    <- Threads (Users), runs last
    JDBC Request "purge test rows"         <- Sampler
  Test Fragment "shared login"             <- inert unless a Module/Include Controller calls it
  Simple Data Writer -> results.jtl        <- Listener (plan level: sees everything below)

go deeper

for a junior

Be able to name the families out loud and give one example element for each. Knowing that a plan needs at least a Test Plan, a Thread Group and a Sampler already puts you ahead of most screening candidates.

for a middle

Explain what membership implies: a Config Element modifies a request but never sends one, a Logic Controller shapes which samplers run, an Assertion only downgrades a result unless its Ignore status box is ticked. Say why samplers cannot live directly under the Test Plan.

for a senior

Use the taxonomy as a review tool. Open an unfamiliar plan, label every node by family, and from that alone say which elements generate traffic, which only shape it, and what will end up in the result file.

for a principal

Own the convention. Decide which families a house plan skeleton mandates, which are banned from committed plans, and how reviewers check that, so plans stay readable across teams rather than each one being a personal arrangement.

## Why the families are the first thing an interviewer probes A JMeter test plan is a tree, and every node in it belongs to exactly one family. Those families are not a documentation convenience: they are the categories the GUI's **Add** menu is assembled from, and membership decides what an element is allowed to do to a request. Naming an element's family is therefore the shortest possible way to say what it contributes, which is why "open this plan and walk me through it" is such a common opening. The manual sets a very small floor: *a minimal test consists of the Test Plan, a Thread Group and one or more Samplers*. Everything else is additive. ## The eleven families JMeter 6.0.0 registers `MenuFactory` registers eleven named categories (plus a separator). These are the labels you actually see: | Add-menu family | What it contributes | | --- | --- | | Threads (Users) | Thread Group, setUp Thread Group, tearDown Thread Group, Open Model Thread Group — the elements that create threads and start execution | | Sampler | Issues a request and produces a sample result: HTTP Request, JDBC Request, Debug Sampler, Flow Control Action | | Logic Controller | Decides which children run and how often: Loop, If, While, Interleave, Transaction, Module, Include, Critical Section | | Config Element | Does not send a request; adds to or modifies the requests samplers send | | Timer | Pauses before each sampler in its scope | | Pre Processors | Acts on a sampler's request before it is issued | | Post Processors | Acts on the response a sampler produced | | Assertions | Judges a response and can mark an otherwise successful sample failed | | Listener | Consumes sample results — displays them, writes them to a result file, or both | | Test Fragment | A container that lives beside a Thread Group and is not executed unless something references it | | Non-Test Elements | Authoring and diagnostic tools such as the HTTP(S) Test Script Recorder, HTTP Mirror Server and Property Display | ## What each family actually contributes Some distinctions are worth stating out loud rather than assumed: - **Thread Group is the entry point.** The manual is explicit that all controllers and samplers must be under a thread group. That is why the Test Plan node's own Add menu offers Threads, Config Element, Listener, Timer, Pre/Post Processors, Assertions, Test Fragment and Non-Test Elements — but neither Sampler nor Logic Controller. - **Samplers and Logic Controllers are both "controllers" in JMeter's vocabulary.** The manual says JMeter has two kinds of controller: samplers, which send requests, and logic controllers, which shape the order in which samplers are processed. - **A Config Element does not send anything.** It "works closely with a Sampler" and can add to or modify a request. The one documented exception is the HTTP(S) Test Script Recorder, which is also a Non-Test Element. - **A Timer is a delay, not a rate.** It causes JMeter to wait a certain time *before* each sampler in its scope. - **An Assertion normally only makes things worse.** In the ordinary path it can mark a technically successful sample as failed but never the reverse — `JMeterThread.processAssertion` ANDs the assertion outcome into the existing status. The documented way back is the Response Assertion's *Ignore status* box (`Assertion.assume_success`, default off): `ResponseAssertion` calls `response.setSuccessful(true)` before evaluating, to allow testing of failure codes, which is how you assert on an expected 404. It also clears any earlier assertion failure, so it must only be set on the first assertion. - **A Listener is passive.** It reads results. The manual notes that all listeners save the same data — they differ only in how they present it — and that a listener collects only from elements at or below its own level. - **A Test Fragment is inert on its own.** It sits at the same level as a Thread Group and never runs unless a Module Controller or an Include Controller references it. ## Reading a plan family by family Given an unfamiliar `.jmx`, the productive first pass is not to read fields but to label nodes: 1. Which Threads (Users) elements exist, and are any of them setUp or tearDown groups? That fixes the phases of the run. 2. Which samplers exist? Those are the only nodes that will produce traffic. 3. Which logic controllers wrap them? Those change how often each sampler fires. 4. What hierarchical elements — config, timers, assertions, listeners, processors — are attached, and at which node? After that pass you can describe the plan without having opened a single panel, and you can already say what will and will not appear in the result file. ## The trap Candidates who have only clicked around the GUI describe a plan element by element ("there's an HTTP Request, then a CSV thing, then a graph"). Candidates who know the taxonomy describe it family by family, and that difference is exactly what the question is measuring.

  • Which two families does the Test Plan node's Add menu deliberately not offer?
    Sampler and Logic Controller. The manual states that all controllers and samplers must sit under a thread group, because a thread is what executes them, so the Test Plan node offers Threads, Config Element, Listener, Timer, Pre and Post Processors, Assertions, Test Fragment and Non-Test Elements only.
  • The plan has a Test Fragment full of samplers, yet nothing in it ever runs. Is that a bug?
    No. A Test Fragment sits at the same level as a Thread Group and is not executed unless a Module Controller or an Include Controller references it. It exists purely for re-use, and JMeter has disabled it by default in the tree since 2.13 so it cannot run itself.
  • Where do Non-Test Elements fit, and should they be in a plan you commit?
    Non-Test Elements are authoring and diagnostic tools — the HTTP(S) Test Script Recorder, HTTP Mirror Server and Property Display. They carry no load and produce no samples. Keeping a recorder in a committed plan is noise at best, so most teams strip them once the plan is captured.

saying these in an interview costs you the question

  • Calling everything a component and never naming its family
  • Believing a Sampler can be added directly under the Test Plan node
  • Claiming Config Elements send requests of their own
  • Treating Listeners as elements that change what the test does
  • Assuming a Test Fragment runs because it sits on the plan tree
open as a page

In a JMeter test plan, in what order do the elements around a single sampler run?

level: juniorimportance: must knowfreq 76%

basics

~10 s

Configuration elements first, then Pre-Processors, then Timers, then the Sampler, then Post-Processors, Assertions and Listeners. The last three are skipped when the sampler returns a null SampleResult.

open as a page

In a JMeter test plan, what does a Test Fragment element do when the plan runs?

level: juniorimportance: must knowfreq 65%

basics

~20 s

A Test Fragment holds test elements but never runs on its own. It sits under the Test Plan beside the Thread Groups, and JMeter executes its contents only when a Module Controller or an Include Controller references it.

open as a page

In a JMeter .jmx file, why does every test element have a hashTree element after it?

level: juniorimportance: must knowfreq 55%

basics

~10 s

A .jmx writes JMeter's tree as alternating pairs: the element, then a hashTree holding that element's children. Nesting lives in the paired hashTree, so an element with no children still gets an empty one.

open as a page

In a JMeter test plan, what decides which samplers a timer or an assertion applies to?

level: juniorimportance: must knowfreq 78%

basics

~20 s

Tree position decides. Timers, assertions, listeners, config elements and pre- and post-processors are hierarchical: they apply to every sampler at or below their parent. Attach one under a single sampler and only that sampler is affected.

open as a page

In a JMeter plan, when do setUp and tearDown Thread Groups run relative to the regular ones?

level: middleimportance: must knowfreq 61%

basics

~10 s

Every setUp Thread Group runs and finishes before the first regular Thread Group starts. tearDown Thread Groups start only after all regular threads have stopped. The engine waits between the phases.

open as a page

In JMeter, why can a sampler not use a value that its own Post-Processor extracts?

level: middleimportance: must knowfreq 68%

basics

~20 s

Post-Processors run after the sampler. Every reference in the request was resolved and the request was sent before the extraction happened, so the earliest consumer of an extracted value is the next sampler the thread reaches.

open as a page

In JMeter, how does a Module Controller find the fragment named in Module To Run?

level: middleimportance: must knowfreq 52%

basics

~10 s

By name, not by identifier. Module To Run stores the target's full path of element names from the tree root, and JMeter walks the tree matching those names when the test starts.

open as a page

A JMeter Thread Group holds a Constant Timer and one sampler under it holds another. What pause runs?

level: middleimportance: must knowfreq 60%

basics

~20 s

Both timers are in that sampler's scope, so JMeter adds their delays together and sleeps once for the total before running it. Every other sampler in the Thread Group waits only for the Thread Group timer.

open as a page

In a JMeter .jmx, what do an element's guiclass, testclass, testname and enabled attributes mean?

level: juniorimportance: should knowfreq 40%

basics

~20 s

They are four JMeter element properties written as XML attributes: the editor panel class, the runtime element class, the display name shown in the tree, and whether the element and its subtree run at all.

open as a page

In JMeter, what separates a Sampler from a Logic Controller when the manual calls both controllers?

level: middleimportance: should knowfreq 54%

basics

~20 s

A Sampler sends a request and produces a sample result. A Logic Controller sends nothing; it decides which of its children run and how often. Both are controllers in JMeter's vocabulary, which is why the distinction gets asked.

open as a page

In JMeter's Include Controller, how is the Filename field resolved into a real path?

level: middleimportance: should knowfreq 44%

basics

~20 s

JMeter builds the path as the includecontroller.prefix property plus the Filename field. If that file is missing and the combined path is not itself absolute, it retries Filename alone against the running plan's own directory. The field takes no variables or functions.

open as a page

In a JMeter .jmx, what do stringProp, boolProp, elementProp and collectionProp each hold?

level: middleimportance: should knowfreq 34%

basics

~10 s

They are JMeter's property tags: stringProp a text value, boolProp a true or false value, elementProp a whole nested test element, and collectionProp an ordered list of properties.

open as a page

In JMeter, what happens when two HTTP Header Managers are in one sampler's scope?

level: middleimportance: should knowfreq 47%

basics

~20 s

JMeter merges them into one header list for that sampler. Where both define the same header name, the manager nearer the sampler keeps its value, and the outer one contributes only the names the inner one does not set.

open as a page

A JMeter Flow Control Action has an extractor and an assertion under it, and neither ever fires. Why?

level: seniorimportance: should knowfreq 33%

basics

~10 s

The Flow Control Action sampler returns a null SampleResult, and Post-Processors, Assertions and Listeners are all skipped when the result is null. Its config elements, Pre-Processors and Timers still run.

open as a page

In JMeter, does a Post-Processor still run against a response that a Response Assertion is about to fail?

level: seniorimportance: should knowfreq 45%

basics

~10 s

Yes. Post-Processors are step 4 and Assertions are step 5, so extraction happens against the error body before anything has judged it. Only a null or ignored SampleResult stops a Post-Processor.

open as a page

A JMeter Include Controller loads login.jmx but none of its samplers run. Why?

level: seniorimportance: should knowfreq 33%

basics

~20 s

The included file almost certainly has no Test Fragment in it. An Include Controller keeps only the subtree under the first Test Fragment it finds, and when there is none it logs a warning and includes an empty tree.

open as a page

A merged JMeter .jmx no longer opens after two engineers edited it the same day. How do you diagnose it?

level: seniorimportance: should knowfreq 46%

basics

~20 s

Separate the two failure modes first: XML that is no longer well formed, or well formed XML whose element and hashTree pairing broke. Confirm each parent version opens, then re-apply the smaller change in the GUI.

open as a page

Standardising a JMeter plan skeleton across several teams, which element families would you mandate and why?

level: principalimportance: should knowfreq 28%

basics

~20 s

Mandate the phase shape and the family placement, not the numbers: a setUp group for preparation, one measured Thread Group per journey, a tearDown group for cleanup, plan-level config elements, one agreed result listener, and no Non-Test Elements committed.

open as a page

Three JMeter plans each need the same login flow. Would you reuse it with a Module Controller or an Include Controller?

level: principalimportance: should knowfreq 38%

basics

~20 s

Put the login flow in its own .jmx behind an Include Controller when three separate plans must share one copy. Use a Module Controller when the reuse lives inside a single plan file and you want the target visible.

open as a page

Your team reviews JMeter .jmx changes by reading the diff. What does that miss, and what would you require instead?

level: principalimportance: should knowfreq 38%

basics

~20 s

A diff shows changed lines, not changed behaviour. One attribute can remove a whole branch, a moved element rewrites many lines and changes nothing, and property keys carry no context. Require the plan to be opened and run.

open as a page

Across a team's JMeter plans, at which tree level would you standardise attaching shared elements?

level: principalimportance: should knowfreq 35%

basics

~20 s

No single level is right, so split by element kind: broad defaults high, session managers exactly once per Thread Group, request-specific elements on the request. The trade is maintenance cost against how visible an element's reach is.

open as a page

In JMeter, does a Pre-Processor scoped to a sampler run before or after that sampler's timers?

level: middleimportance: nice to knowfreq 26%

basics

~10 s

Before. JMeter runs every Pre-Processor in scope, then serves the timers, then invokes the sampler. Anything a Pre-Processor computes is already as old as the pause when the request finally leaves.

open as a page

On a JMeter .jmx root element, what do the version, properties and jmeter attributes mean?

level: middleimportance: nice to knowfreq 18%

basics

~10 s

They record the JMX format version, the version of JMeter's save-alias file, and the JMeter build that wrote the file. Only the first is read back, and it barely changes anything.

open as a page

Why does a JMeter XML result file carry every response body when no listener was configured to save one?

level: seniorimportance: nice to knowfreq 33%

basics

~10 s

Functional Test Mode was ticked on the Test Plan element. That single checkbox writes TestPlan.functional_mode and forces Response Data and Sampler Data into every result file, overriding each listener's own save configuration.

open as a page