On this page4 sections
ReferenceIntermediate4-6 min reference

Rate Limiting Testing

Rate limiting protects an API from abuse and overload by capping how many requests a client may make in a window. QA's job is to confirm the limit exists, returns the right signal, and recovers correctly — without launching an actual attack. This sheet is the reference; see Security Headers and the API Negative Testing Matrix for neighbours.

The signals

SignalLooks likeCheck
Status429 Too Many RequestsReturned once the limit is exceeded
Retry-Afterseconds or HTTP-dateTells the client when to retry
X-RateLimit-Limite.g. 100The cap for the window
X-RateLimit-Remaininge.g. 0Requests left; decrements each call
X-RateLimit-Resetepoch / secondsWhen the window resets

(Header names vary — also RateLimit-* per the draft standard.)

Common strategies

StrategyBehaviour
Fixed windowN requests per clock window; resets on the boundary
Sliding windowN requests over a rolling period
Token bucketTokens refill at a rate; burst up to bucket size
Leaky bucketSteady drain; smooths bursts

What QA can safely verify

  • The limit triggers at the documented threshold → 429.
  • Retry-After is present and honoured (waiting then retrying succeeds).
  • X-RateLimit-Remaining decrements and resets after the window.
  • Limits are scoped correctly (per user / IP / API key), not global by accident.
  • A 429 returns a clean body — no stack trace.

Keep it to documented thresholds; sustained high-volume flooding is load/security-team territory, not a functional check.

Common mistakes

  • Confusing 429 (rate limit) with 503 (overload) or 403 (forbidden).
  • Testing the limit triggers but never that it resets.
  • Ignoring Retry-After, so a client hammers the API during cooldown.
  • Assuming one global limit when it's per-key/per-route.