Configure the JMeter While Controller logic controllers: properties, defaults, and practical usage notes for building reliable load tests.
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.โ

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}- whereVARis set to false by some other test element\${__jexl3(\${C}==10)}\${__jexl3("\${VAR2}"=="abcd")}\${_P(property)}- where property is set to โfalseโ somewhere else
| Name | Required | Description |
|---|---|---|
| Name | No | Descriptive name for this controller that is shown in the tree, and used to name the transaction. |
| Condition | No | blank, LAST, or variable/function |
Common gotchas
Section titled โCommon gotchasโ- 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.
Related
Section titled โRelatedโOn this page
On this page