Handling Flaky Tests at Scale: Auto Detection & Suppression
Slack's mobile DevXp team cut CI test job failures from 57% of failing builds to under 5% by automating flaky test detection and suppression across 27,000+ iOS and Android tests. A first approach filtered flaky results using a per-test failure threshold over recent main-branch history, and it quickly raised build stability. It was rolled back because broken new tests and failed fixes leaked into main, and CI depended on a backend. The second approach suppresses test execution on the main branch only. It detects failures (excluding infra, crash and API failures), maps each test to an owning team, files a Jira ticket, then opens and auto-merges a PR that disables the test.
Related posts
- Balancing Safety and Velocity in CI/CD at Slack
Slack Engineering mediumAdeptSlack restructured CI for its Webapp monorepo from mostly pre-merge end-to-end testing into three tiers: a small pre-merge set (<1% of e2e tests) that blocks merges, a post-merge set (<10%) that blocks deploys, and a bi-hourly batched regression pipeline for low-criticality features. The move was driven by the arithmetic of flakiness: even a 1% per-suite flake rate across 60+ suites meant most PRs hit a flaky failure. Consecutive-failure alerts based on a state machine, per-business-area triage channels with test ownership, and a Slack bot that spins up escalation channels with the right liaisons kept the change safe. Afterwards p95 test turnaround fell over 40% to under 18 minutes, per-PR flakiness dropped over 90% to under 5%, and customer-reported defects showed no measurable increase.
- Mobile Developer Experience at Slack
Slack Engineering mediumAdeptA dedicated mobile Developer Experience team grew from 3 to 8 engineers and cut CI feedback time and failure rates by targeting the pain points that surveys, NPS and metrics like time to merge showed hurt developers most. iOS test time fell from about 50 minutes to an average of 9 by moving from Xcodebuild to Bazel with disk caching and bazel-diff, so only affected targets are tested. On Android, test sharding (in-house Fuel, later Flank) cut runs from 50+ minutes to under 20, and replacing Calabash with Espresso took suites from ~350 to ~60 minutes. Further gains came from auto-suppressing flaky tests (failure rate 57% to 4%), migrating from Jenkins to Buildkite (CI stability ~87% to 95%, TTM down 41%), generating Xcode projects with Xcodegen to avoid merge conflicts, and adopting a merge queue.
- How GitHub reduced testing time for iOS apps with new runner features
GitHub Engineering mediumAdeptGitHub's iOS team cut CI testing time by 60%, from 38 to 15 minutes, by moving to Apple silicon M1 macOS runners (macos-14-xlarge) and splitting a single monolithic build-and-test job into per-module jobs across roughly 60 first-party modules. Small modules finish in 2-3 minutes, and failures are easier to isolate. The team also split each module's CI into separate build and test steps with xcodebuild's build-without-testing and test-without-building to find slow tests. Matching CI and laptop architecture lets engineers reproduce architecture-specific failures locally, and the team fans out 50 concurrent jobs per pull request.
- How we raised mobile end-to-end test stability to 98%
Shopify Engineering mediumAdeptShopify rebuilt its mobile end-to-end test framework as an opinionated wrapper over Appium, raising test stability from 50% to 98% and returning the suite to blocking PR checks. The wrapper exposes a small builder-style API where every action must carry an assertion that is validated as false before the step and true after. Escape hatches like custom timeouts and Test IDs are prefixed UNSAFE_. Elements are located visually rather than through the view hierarchy: PaddleOCR finds text, and OpenCV matches grayscale Polaris SVG icons, including color-inverted variants and multiple sizes, using adjacency to tell duplicates apart. Annotated run videos, a single CLI for local and remote device-farm runs, and a pre-promotion gate that reruns new tests before admitting them to CI round out the approach.
- App stability at scale with a layered defense
Grab Engineering mediumAdeptGrab keeps its Android and iOS superapp stable with a layered, shift-left defense against crashes. Prevention comes first: lint rules (including custom rules written from post-mortems) block merges in CI, followed by unit, UI component, E2E and manual QA testing and a mandatory one-week Grab Early Access build that auto-tickets new crashes. At the release gate, a week-long staged rollout monitors the new version's crash rate in isolation and auto-pauses expansion, while feature flags act as kill switches. In production, hard-threshold and trend alerts, a flag-first → server-side fix → hotfix escalation ladder, automated triage with severity SLAs, and a flag-rollout history dashboard contain and diagnose crashes that slip through.