skip to content

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

level: seniorimportance: should knowfreq 33%

answer

  1. Not every sampler produces a sample
  2. Three families need a result to exist
  3. Three others run before the sampler
  4. The manual writes it as a qualifier

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.

solid answer

~40 s

The **Flow Control Action** sampler produces no sample at all: its `sample()` method ends with `return null; // This means no sample is saved`. JMeter's execution order marks steps 4, 5 and 6 — Post-Processors, Assertions and Listeners — as *unless the SampleResult is null*, and the engine implements all three under one `if (result != null)` guard. So the extractor never runs, the assertion never runs, and nothing appears in any listener or the results file for that element. Steps 0 to 2 are unaffected, because they happen before the sampler is invoked: config elements, Pre-Processors and Timers under a Flow Control Action all still execute. If you need the extraction or the check, move it under a sampler that actually produces a result.

code

text · 7 lines
text
Simple Controller
  Flow Control Action  (Pause, 2000 ms)
    Constant Timer          <- runs: step 2, before sampling
    JSR223 PreProcessor     <- runs: step 1, before sampling
    JSON Extractor          <- never runs: step 4, needs a SampleResult
    Response Assertion      <- never runs: step 5, needs a SampleResult
  HTTP Request  GET /cart   <- the sampler that does produce a result

go deeper

for a junior

Recall that some samplers produce no result at all, and that the three families which read a result are skipped when there is none.

for a middle

Explain the single null guard in the engine and name which families sit before it and which sit after it.

for a senior

Diagnose this from the symptom, which arrives as a broken extractor rather than as a missing sample, and use the absence of any listener row as the tell.

for a principal

Decide when a step deserves a recorded sample and when silence is correct, so that control-flow elements never quietly swallow verification a team believes is running.

## What the element returns The **Flow Control Action** sampler does not produce a sample. Its `sample()` method performs the pause or the stop it was configured for and then ends with: ```java return null; // This means no sample is saved ``` The component reference says the same thing in prose: *"Rather than generate a sample, the test element either pauses or stops the selected target."* ## Why that silences three whole families The engine's post-sampling work sits inside a single guard. In `JMeterThread.executeSamplePackage(...)`: ```java SampleResult result = null; if (running) { result = doSampling(threadContext, pack.getSampler()); } if (result != null) { runPostProcessors(pack.getPostProcessors()); checkAssertions(pack.getAssertions(), result, threadContext); notifyListeners(sampleListeners, result); } else { compiler.done(pack); // finish up and move on } ``` A `null` result takes the `else` branch, so all three of Post-Processors, Assertions and Listeners are skipped for that element. The manual encodes this in its execution-order list, where steps 4, 5 and 6 each carry the qualifier *"unless the SampleResult is null"*. Concretely, under a Flow Control Action: - an extractor never runs, so the variable it would set stays at its previous value &mdash; or, if nothing has ever set it, later requests carry the literal `${name}` reference; - an assertion never runs, so nothing it would have caught is caught; - no listener is notified, so nothing appears in View Results Tree, nothing in the aggregate tables, and no row is written to the results file. The element is invisible in the output by design. That is not a bug report; it is the point of the sampler. ## What still runs underneath it Steps 0 to 2 happen before the sampler is invoked, so they are unaffected: | Child element | Runs under a Flow Control Action? | |---|---| | Config element | Yes | | Pre-Processor | Yes | | Timer | Yes | | Post-Processor | No | | Assertion | No | | Listener | No | That asymmetry is deliberate and documented &mdash; the component reference tells you to attach a Timer to a Flow Control Action when you want a variable-length pause that costs nothing in the results. ## How to diagnose it when you meet it You will normally meet this as "my extractor stopped working" rather than as a question about null results. The tells: 1. The element that owns the child is a Flow Control Action, not an HTTP Request or other real sampler. 2. Nothing at all appears for it in a listener, not even a failed row. 3. Moving the same child under the neighbouring real sampler makes it start working immediately. If you need the extraction or the check, move it to a sampler that produces a result. If you need the control-flow behaviour *and* a recorded step, use a real sampler and let the Flow Control Action do only the pausing or stopping. ## Naming The element has been called **Flow Control Action** since JMeter 5.0; before that the same component was named **Test Action**, and older plans, screenshots and blog posts still use that label. The behaviour described here is Apache JMeter 6.0.0.

  • How would you confirm this is the cause rather than a broken extractor expression?
    Check whether anything at all appears for the element in a listener. A real sampler that failed still writes a row; a Flow Control Action writes none, because listeners are skipped along with the extraction. Moving the same child under the neighbouring real sampler and seeing it work immediately confirms it.

saying these in an interview costs you the question

  • Blames the extractor expression rather than the missing SampleResult
  • Expects a failed row in the listener for a Flow Control Action
  • Thinks nothing at all under a Flow Control Action executes
  • Says a longer pause duration would make it produce a sample
  • Assumes only listeners are skipped and extraction still happens