Class LoadCapture


public class LoadCapture extends ObjectWithJsonToString
Declarative cross-step capture / correlation rule for a LoadStep. After the step's response returns, each capture extracts a value from that response and binds it to name in the iteration's mutable captured-variable map, so a SUBSEQUENT step in the SAME iteration can reference it from its templated request fields (path, body and headers) via $iteration.captured.<name> (Velocity) / {{iteration.captured.<name>}} (Mustache).

Scope is per-iteration — one virtual user's single pass through the steps (the natural "one user session" correlation scope). The map is created fresh at the start of each iteration and is never shared across virtual users or across a VU's successive iterations, so it is race-free and captures never leak between users or runs.

The primary use case is a login step capturing a token that later steps replay, e.g. Authorization: Bearer {{iteration.captured.token}}.

  • getName() — the variable name later steps reference
  • getSource() — where to extract from (response body JSONPath, header, or body regex)
  • getExpression() — the JSONPath, header name, or regex (group 1 for regex)
  • getDefaultValue() — used when extraction yields nothing (otherwise the var is left unset)
  • Constructor Details

    • LoadCapture

      public LoadCapture()
  • Method Details

    • loadCapture

      public static LoadCapture loadCapture()
    • loadCapture

      public static LoadCapture loadCapture(String name, LoadCapture.Source source, String expression)
    • getName

      public String getName()
      The variable name later steps reference (may be null/blank, in which case the capture is skipped).
    • withName

      public LoadCapture withName(String name)
    • getSource

      public LoadCapture.Source getSource()
      The extraction source (may be null, in which case the capture is skipped).
    • withSource

      public LoadCapture withSource(LoadCapture.Source source)
    • getExpression

      public String getExpression()
      The JSONPath, header name, or regex driving extraction (may be null, in which case the capture is skipped).
    • withExpression

      public LoadCapture withExpression(String expression)
    • getDefaultValue

      public String getDefaultValue()
      The fallback value bound to name when extraction yields nothing (may be null, in which case the variable is left unset on no match).
    • withDefaultValue

      public LoadCapture withDefaultValue(String defaultValue)