BestPromptFinder
Fix a Flaky Test That Passes Sometimes and Fails Sometimes
85AI Quality /100
93AI Usefulness est. /100
85Eval Confidence /100
No votes yetCommunity results
The prompt
Help me fix a flaky test. Test code: [paste] Code under test: [paste the relevant parts] Failure output: [paste one or more failing runs] How often it fails: [e.g. 1 in 10 runs, only in CI, only when run with other tests] Environment: [language, test framework, CI system, parallel or not] Work through the usual causes and say which fit the evidence: 1. Timing: sleeps, timeouts, async code not awaited, animations or network calls. 2. Shared state: tests depending on order, global variables, leftover database rows or files. 3. Randomness and time: random data, current date or time zone, unordered collections. 4. External dependencies: real network, third-party APIs, clocks. 5. Resource limits in CI: slower machines, parallel workers. Then give me: - The most likely cause with the evidence. - A fix that removes the cause (not a retry or a longer sleep), as a diff. - A way to prove it's fixed: e.g. run the test 200 times in a loop, or in random order. Rules: if the evidence isn't enough, tell me exactly what to log or run next.Find similar in the app →
Did this prompt work for you?
Why this prompt
- Hand-picked, editorially reviewed prompt
- Written for Claude, ChatGPT, Gemini
Source
Created by BestPromptFinder — editorial prompt, not user-generated. See our content & source policy.
Related Coding prompts
Python: Download a CSV From a URLQuality 94 · GPT-5.6Public-Market and Competitor Data Collection Agent
Quality 92 · GPT-5.6Plain-English to SQL Query Writer
Quality 91 · GPT-5.6PRD to MVP Technical Plan
Quality 90 · Claude CodeThird-Party API Integration
Quality 90 · Claude CodeDatabase Schema and Migration
Quality 90 · Claude Code