FailSafe Docs
Experiments Guide

Running Experiments

Detailed guides for chaos testing across all supported platforms.

Backend Testing

Backend testing targets Docker containers running your services. FailSafe injects faults directly into container processes and network stacks.

Docker Targets

Specify targets using container names or labels. FailSafe will discover all matching containers.

# By container name
"targets": ["api-service", "database"]

# By label selector
"targets": ["app=myapp", "env=staging"]
Dependency Graph

FailSafe can automatically detect service dependencies and calculate blast radius. This helps you understand the cascade impact of failures.

# Response includes dependency information
{
  "targets": ["api-service"],
  "dependencies": ["database", "cache"],
  "blast_radius": 3,
  "cascade_depth": 2
}

Available Fault Types

cpu_stress

Consumes CPU cycles. Intensity = percentage of CPU to use.

memory_stress

Allocates memory. Intensity = percentage of available memory.

kill

Terminates processes. Intensity = percentage of containers to kill.

network_delay

Adds latency. Intensity = milliseconds of delay.

packet_loss

Drops packets. Intensity = percentage of packets to drop.

Frontend Testing

Frontend testing injects faults into web applications through a service worker or proxy. This allows testing user-facing behavior under degraded conditions.

Metrics Collector Setup

Add the FailSafe metrics collector to your web application:

<script src="https://failsafe.io/collector.js"></script>
<script>
  FailSafe.init({
    apiKey: 'fs_your_key',
    endpoint: 'http://localhost:8000'
  });
</script>
Web Vitals Monitoring

FailSafe automatically collects Core Web Vitals during experiments:

LCP (Largest Contentful Paint)

Measures loading performance. Good: <2.5s

CLS (Cumulative Layout Shift)

Measures visual stability. Good: <0.1

INP (Interaction to Next Paint)

Measures interactivity. Good: <200ms

Android Testing

Android testing runs your app in an emulator and injects faults through ADB commands and network interception.

APK Upload

Upload your debug APK to begin testing:

curl -X POST http://localhost:8000/android/upload \
  -H "x-api-key: fs_your_key" \
  -F "apk=@app-debug.apk"
Emulator Configuration

Configure the Android emulator for testing:

{
  "emulator": {
    "name": "Pixel_6_API_33",
    "sdk_version": 33,
    "screen_density": 420
  },
  "network_profile": "LTE"
}

Available network profiles: LTE, 3G, EDGE, GPRS, Full

Android-Specific Faults

network_throttle

Degrades network speed. Intensity = bandwidth reduction %.

battery_drain

Simulates low battery. Intensity = battery level %.

memory_pressure

Triggers low memory conditions. Intensity = memory pressure level.

airplane_mode

Toggles airplane mode on/off during test.