Skip to content

Tests and Chaining

Thiago Miranda edited this page Jun 17, 2026 · 2 revisions

Tests and Chaining

Getman has a no-code rules engine, configured per request in the RULES tab. It does two things after each send:

  1. Assertions — verify conditions about the response (pass/fail).
  2. Extractions — capture values from the response into Environments and Variables variables, so the next request can use them ("chaining").

Results show in the Responses of the response panel.

The RULES tab

The RULES tab has two sections — EXTRACT VARIABLES and ASSERTIONS — each with an add button and a list of rule cards. Every rule has an on/off toggle and a delete (trash) button. Rules are stored per request and run automatically on every send.

Assertions

Click ADD ASSERTION. Each assertion has a target, a comparator, and (usually) an expected value.

Targets

Target Checks Needs a path?
STATUS HTTP status code
TIME (ms) Response duration in ms
BODY (JSONPath) A value at a JSONPath in the JSON body (e.g. $.data.id) JSONPath
HEADER A response header value (case-insensitive name) header name

Comparators

Comparator Meaning Expected value
= (equals) exact string match any
(not equals) not equal any
contains actual contains expected substring any
< (less than) numeric: actual < expected number
> (greater than) numeric: actual > expected number
in range numeric: lo ≤ actual ≤ hi lo-hi (e.g. 200-299)
exists the header/JSONPath is present — (no expected)

The matching fields adapt to your choice (a JSONPath/header field appears for those targets; the EXPECTED field hides for exists and becomes lo-hi for in range).

Example assertions

  • STATUS in range 200-299 — succeeded?
  • TIME (ms) < 800 — fast enough?
  • BODY (JSONPath) $.token exists — got a token?
  • HEADER Content-Type contains application/json — right type?

Each result in the TESTS tab shows a ✓/✗, a readable label, and the actual value found.

Extractions (chaining)

Click ADD EXTRACTION. Each rule reads a value from the response and writes it to an environment variable.

Shortcut: in the response BODY pane's Responses#tree-view view, open any node's menu and choose Extract to {{var}} — it adds a JSON-path extraction rule for that exact node (with a suggested variable name) without hand-typing the path. Refine the variable name here in the RULES tab.

Sources

Kind Expression Reads
JSON PATH a JSONPath (e.g. $.data.token) a value from the JSON body
HEADER a header name a response header value (case-insensitive)
REGEX a regex pattern capture group 1 (or the whole match) against the body text

Set TARGET VARIABLE to the environment variable name to write (e.g. auth_token).

Write-back behavior

After a send, each enabled extraction with a target runs:

  • On success, the captured value is written into the active environment (a toast confirms: Captured → {{auth_token}}, …).
  • If no environment is active, captures are held pending and Getman tells you to select one; they're flushed once you pick an environment.
  • Captures are de-duplicated so each is written once per send.

A typical chain

  1. Login request with an extraction: JSON PATH $.tokenauth_token.
  2. Subsequent requests use Authorization: Bearer {{auth_token}} (set in the Authentication or a header).
  3. Send the login once; every later request now carries the fresh token.

Order of operations

On each send: the request is sent (with variables resolved) → the response arrives → extractions and assertions run against the decoded body → the TESTS tab updates → captured values are written back to the active environment.

Clone this wiki locally