Skip to content

Switch Controller

Configure the JMeter Switch 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.

Switch Controller

The Switch Controller acts like the Interleave Controller in that it runs one of the subordinate elements on each iteration, but rather than run them in sequence, the controller runs the element defined by the switch value.

If the switch value is out of range, it will run the zeroth element, which therefore acts as the default for the numeric case. It also runs the zeroth element if the value is the empty string.

If the value is non-numeric (and non-empty), then the Switch Controller looks for the element with the same name (case is significant). If none of the names match, then the element named โ€œdefaultโ€ (case not significant) is selected. If there is no default, then no element is selected, and the controller will not run anything.

NameRequiredDescription
NameNoDescriptive name for this controller that is shown in the tree.
Switch ValueNoThe number (or name) of the subordinate element to be invoked. Elements are numbered from 0. Defaults to 0
On this page