Skip to Main Content
Features

Delay and failure simulation

Add delay and failure behavior to endpoint responses for realistic performance and flake testing.

Purpose

Simulate real-world latency and failure percentages on local endpoints.

Where this is used

Used when testing loading states, retry logic, and client error handling without touching backend systems.

Setup and prerequisites

  • Endpoint in MOCK mode.
  • Valid status code and response payload set for mock path.
  • Optional custom failure response if default is not desired.

Step-by-step

  1. Open endpoint settings.
  2. Set Delay (ms), for example 300.
  3. Set failure rate as decimal 0 to 1.
    • 0 never fails
    • 0.2 fails around 20% of matching calls
    • 1 always fails
  4. Optionally define failure status, headers, and body.

Expected result/output

  • When delay is set, request durations in Live View increase accordingly.
  • When failures occur, status/headers/body follow custom failure response.
  • If no custom failure response is set, default body is {"error":"mock_failure"}.

Common issues + fixes

  • No failures observed: confirm failure rate is above 0 and endpoint is actually in MOCK mode.
  • Unexpected status: check mode and whether upstream is handling the call (PASSTHROUGH/DISABLED do not use these controls).
  • Long waits not showing: confirm delay applies and client is reading request duration from endpoint latency.

For CI stability tests, combine this withCI contract testing use case.

Delay and failure settings
Screenshot placeholder
Placeholder: mock endpoint delay and failure settings with default and custom failure payload options.
Placeholder: delay and failure setup