Group
  • Testing

    Fix my slow, flaky test suite

    Find the tests that drag or fail intermittently and fix them so the suite stays worth running.

    • Debug & fix
    • Ship faster
    • Intermediate
    • General

Free Prompt

My test suite is slow, or flaky, or both, and I'm starting to skip running it. I want it fixed before I abandon it entirely. Diagnose first: 1. Run the suite (tell me the command and I'll run it if needed) and report total runtime plus the ten slowest tests. 2. Identify flaky tests by running the suite several times and listing any test that fails intermittently. Then fix the usual causes: 1. Slowness: tests hitting the real network, real disk, or real external services that should be stubbed; unnecessary sleeps and waits; full app boot per test when a lightweight setup would do; missing database cleanup forcing expensive rebuilds. 2. Flakiness: dependence on execution order, shared state between tests, real timers and dates instead of controlled ones, random data in assertions, and race conditions in async setup. Apply fixes in the tests themselves. Only touch production code if a flaky test is revealing a real race condition, and if that's the case, stop and show me first. When done, run the suite three times and report: total runtime before and after, and zero intermittent failures across runs. If any test can't be made reliable, recommend deleting or quarantining it with a note, because one flaky test teaches the whole team to ignore failures.

What This Does / How This Helps

This finds and fixes the slow and flaky tests in your suite: real network calls, sleeps, order dependence, uncontrolled timers, and shared state. A suite that takes twenty minutes gets run never. A suite that fails randomly gets ignored, and then real failures slip through inside the noise. This is maintenance on the thing that protects everything else, and it's the difference between a test suite that survives launch and one that gets deleted in a frustrated commit two months from now.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts