FailSafe Docs
Android Testing

Android Chaos Testing

Upload an APK, start an Android experiment, then poll status and metrics from the verified endpoints.

APK Upload

Upload Endpoint
POST http://localhost:8000/upload/apk
Content-Type: multipart/form-data

file: <binary APK file> OR apk: <binary APK file>
{
  "id": "apk-uuid-here",
  "apk": "apk-uuid-here",
  "path": "D:\FailSafe\uploads\apks\apk-uuid-here.apk",
  "package": "com.example.code",
  "activity": "com.example.code.MainActivity"
}

Start Experiment

Start Android Experiment
POST http://localhost:8000/experiments/android/start
{
  "fault_type": "kill_app",
  "targets": ["com.example.code"],
  "target_type": "android",
  "observation_type": "android",
  "duration_seconds": 70,
  "apk": "apk-uuid-here",
  "android_run": {
    "avd_name": "Pixel_8a",
    "headless": true,
    "reset_app_state": true
  },
  "scenarios": [
    { "type": "kill_app", "at": 20, "duration_seconds": 1 },
    { "type": "foreground_app", "at": 30, "duration_seconds": 2 }
  ],
  "expected": {
    "running": true,
    "not_crash": true,
    "not_anr": true,
    "should_recover": true
  }
}
{
  "id": "exp-android-uuid",
  "state": "running",
  "phase": "baseline",
  "fault_type": "kill_app",
  "package": "com.example.code"
}

Status and Metrics

Verified Polling Routes
GET http://localhost:8000/experiments/android/status?id={experiment_id}
GET http://localhost:8000/experiments/android/metrics?id={experiment_id}
POST http://localhost:8000/experiments/android/stop?id={experiment_id}