Make it misbehave on purpose

Return 429s, 500s and 503s with the right headers, or respond slowly, so your retry, back-off and timeout handling gets a real workout. Deterministic, so a test repeats.

A perfect happy path is not enough to test a client well. Real APIs rate-limit, fail, and slow down, and your app needs to cope. So Understudy can misbehave on purpose.

Fault rules

A simulation can carry fault rules. When an enabled rule matches a request, the runtime returns the rule's response instead of handling the request normally. You set them up in the editor's Faults tab, with no code.

A rule has:

  • A match: an HTTP method, or any, and a path, or * for any path.
  • A response: a status code, optional headers like Retry-After: 2, and an optional JSON body like { "error": "rate limited" }.
  • A delay: optional latency before responding. A rule with a delay but no status is latency-only, so the response is slow but otherwise normal, for testing timeouts.

Deterministic by design

Faults fire predictably, not at random. The same setup behaves the same way every run, so a test that relies on a 429 stays stable instead of flaking.