A request can reach the server successfully while still leaving an empty or outdated value for the next request. In JMeter, a Debug Sampler adds a result that exposes the variables available at that point in the test.

The starting point is an open test plan already reduced to one virtual user and one loop, with a request that creates a variable. Variables belong to individual virtual users, so a debug sample shows the values held by the thread that runs it.

View Results Tree retains response data in memory, which adds work for the JMeter client. Both the listener and Debug Sampler are temporary additions for investigation; leaving them enabled during a load test can affect the measurements.

Steps to add a JMeter Debug Sampler for a debug run:

  1. Select the thread group containing the request whose variables you want to inspect.
  2. Choose Add → Sampler → Debug Sampler from the thread group's right-click menu.
  3. Check that Debug Sampler follows the request that creates the variable.

    An extractor runs as a child of its request; the Debug Sampler belongs after that request, at the same tree level. If it was added below later requests, it can be dragged into position. A new sampler has JMeter variables set to True and both property options set to False, which limits the output to variables.

  4. Add View Results Tree through the thread group's Add → Listener → View Results Tree menu.

    An existing View Results Tree under this thread group can be reused.

  5. Save the test plan through File → Save.

    Debug output can contain passwords, session tokens, and other sensitive variables. It needs the same protection as the original values. Before a later load test, both Debug Sampler and View Results Tree need to be disabled or removed.
    Related: How to disable heavy JMeter listeners before a load test

  6. Start the one-user, one-loop test through Run → Start.
  7. Select the Debug Sampler entry in the listener's result list.
  8. Open the selected result's Response data tab.

    The Text renderer displays the variable list. The listener's pane dividers can be collapsed or resized if the tabs or values are out of view.

  9. Confirm that Response Body lists your variable with its expected value.

    The checkout request shown here extracts a value into csrf_token. Its value appears beneath JMeterVariables: along with the extractor's group variables. A missing variable or the extractor's default value, such as NOT_FOUND, means the expected value was not available at this point; a green sample icon alone does not prove extraction worked.
    Related: How to extract values with a regular expression in JMeter

Share this guide