Skip to content

While Controller

Configure the JMeter While Controller logic controllers: properties, defaults, and practical usage notes for building reliable load tests.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

Part of the Logic Controllers category. Also documented in context in the full Component Reference.

TL;DR: the While Controller repeats its children as long as a condition stays true (or forever, if left blank, until the enclosing loop/thread stops) โ€” the standard element for polling patterns like โ€œkeep checking job status until itโ€™s done.โ€

While Controller

The While Controller runs its children until the condition is โ€œfalseโ€.

Possible condition values:

  • blank - exit loop when last sample in loop fails
  • LAST - exit loop when last sample in loop fails. If the last sample just before the loop failed, donโ€™t enter loop.
  • Otherwise - exit (or donโ€™t enter) the loop when the condition is equal to the string โ€œfalseโ€

For example:

  • \${VAR} - where VAR is set to false by some other test element
  • \${__jexl3(\${C}==10)}
  • \${__jexl3("\${VAR2}"=="abcd")}
  • \${_P(property)} - where property is set to โ€œfalseโ€ somewhere else
NameRequiredDescription
NameNoDescriptive name for this controller that is shown in the tree, and used to name the transaction.
ConditionNoblank, LAST, or variable/function
  • A blank condition means loop forever (until the thread is told to stop) โ€” a very common way to accidentally hang a test plan; always set an explicit exit condition or a max-iteration guard variable.
  • The condition is re-evaluated after each pass through the children, so the loop always runs at least once โ€” model that if your logic assumes a โ€œcheck first, then maybe runโ€ pattern.
  • Same JavaScript-expression syntax as If Controller ("${done}" != "true"), including the same quoting pitfalls.
  • For polling with a bounded wait, pair with a Constant Timer inside the loop (see Timers, Think Time & Pacing) so youโ€™re not hammering the endpoint every iteration.
On this page