Negative testing: every error code on demand

A test suite that only covers the happy path is testing the case that was never going to break. The catalog is built so every error is reachable on purpose: a guaranteed 500, a real rate limit, a teapot, and a fault injector that produces whatever you configure.

Negative testing — request and response sequence Sequence diagram for Negative testing: POST /llm/v1/chat/completions answers 400 Bad Request. POST /cargo/v1/shipments/{id}/attempt-delivery answers 401 Unauthorized. DELETE /protocol/v1/documents/{id} answers 403 Forbidden. POST /llm/v1/messages answers 404 Not Found. Your client Fun API Playground POST /llm/v1/chat/completions 400 Bad Request Chat Completions shape: streaming (SSE), tools, JSON mode… POST /cargo/v1/shipments/{id}/attempt-delivery 401 Unauthorized Attempt delivery — may fail, 3 strikes returns it (X-API-… DELETE /protocol/v1/documents/{id} 403 Forbidden Delete a document (admin only, then 410) POST /llm/v1/messages 404 Not Found Messages shape: content blocks, tool_use, SSE events, fai…
Real endpoints from the catalog — every request above is served, and every status code shown is one that endpoint actually returns.

How to practise it

  1. Call the Pizza oven endpoint for a reliable 500 and verify your client retries, falls back, or reports it — but does not hang.
  2. Use the Fault Injection API to set a status code, a latency and a failure rate, then run your suite against it.
  3. Separate 400 from 422: one means the request was unreadable, the other that it was understood and refused.
  4. Separate 401 from 403, and 404 from 410. Each pair is routinely collapsed, and each collapse hides a real bug.
  5. Inject a malformed body and confirm your client reports a parse error rather than crashing.

APIs to try it on

Status codes involved

Other techniques

Getting started guide · All 55 mock REST APIs

Last updated