Back to docs

Tool Chaos Test

Category: Testing · Tier: All

Inject failures and test resilience

When to Use

Testing tools generate and validate test cases in natural language. They also detect unreliable tests and map coverage.

Parameters

Parameter Type Required Description
url string Yes URL to test
networkLatency number No Simulate network latency (ms)
offline boolean No Simulate offline mode
blockUrls array No URL patterns to block
failApis array No Requests to answer with an error status instead of the real response, the CLI's --fail-api pattern:status. Each entry is { pattern, status, body? }: pattern is a substring of the request URL, status an HTTP status from 100 to 599, body an optional response body (default "Chaos: Simulated failure")

Requests answered by failApis are listed in the response under impact.failedResources.

Example

Test what happens when the API is slow or offline
Fail the checkout API with a 503
and see how the page copes
→ failApis: [{
    pattern: "/api/checkout",
    status: 503
  }]

Tips

  • Natural language tests need no code -- just describe what to verify
  • Save tests to files and run them in CI/CD pipelines

Research

  • Hick-Hyman Law — Decision time = a + b × logâ‚‚(n) for n choices

From the Blog