API Testing Patterns
ELI5 — The Vibe Check
API Testing Patterns are strategies for testing your APIs thoroughly: happy path, error responses, validation, auth, pagination, rate limiting. Don't just test 'does it return 200' — test 'does it return 403 without auth, 422 with bad data, and 429 when rate limited?'
Real Talk
API testing encompasses functional (status codes, response bodies, headers), security (auth, injection, rate limiting), performance (latency, throughput), and contract (schema validation, backward compatibility) testing. Tools include Supertest, REST Assured, and Postman. Test pyramid suggests more API tests than E2E, fewer than unit.
When You'll Hear This
"Our API test suite covers happy paths, validation errors, auth failures, and edge cases." / "Every API endpoint has contract tests that validate the response schema against OpenAPI."
Related Terms
Contract Testing
Contract testing verifies that two services agree on their API contract — the request format, response shape, and status codes. It's like checking that the
Mock Server
A Mock Server pretends to be a real API. It returns predefined responses so your tests don't depend on external services. The payment API is down?
Pact
Pact is contract testing for APIs. The consumer (frontend) writes what it expects from the provider (API), and Pact verifies both sides honor the contract.