flaky-test-management
Skill1 starsChanged 54 days agoMITView on GitHub
Use when tests pass and fail intermittently — detecting, quarantining, root-causing and eliminating flaky tests (async waits, shared state, order dependence, time, network, resource contention) with retries policy, flake dashboards and CI reruns.
In this repository98 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 42crunch-api-security-testingSkill
- a-b-testingSkill
- acceptance-testingSkill
- accessibility-testingSkill
- ai-agent-evaluationSkill
- ai-code-securitySkill
- ai-ml-testingSkill
- analytics-tracking-testingSkill
- api-testingSkill
- authn-authz-testingSkill
- autonomous-qa-orchestrationSkill
- bdd-gherkin-testingSkill
- blockchain-smart-contract-testingSkill
- bug-reportingSkill
- chaos-resilience-testingSkill
- chatbot-voice-agent-testingSkill
- cicd-testingSkill
- cli-testingSkill
- cloud-infrastructure-testingSkill
- code-coverage-analysisSkill
- compatibility-testingSkill
- compliance-testingSkill
- concurrency-race-condition-testingSkill
- configuration-feature-flag-testingSkill
- contract-testingSkill
- cross-browser-testingSkill
- database-testingSkill
- data-migration-testingSkill
- data-pipeline-etl-testingSkill
- date-time-timezone-testingSkill
- desktop-app-testingSkill
- disaster-recovery-backup-testingSkill
- e2e-testingSkill
- email-notification-testingSkill
- event-driven-messaging-testingSkill
- exploratory-testingSkill
- functional-testingSkill
- fuzz-testingSkill
- game-testingSkill
- graphql-testingSkill
- iac-container-security-testingSkill
- installation-upgrade-testingSkill
- integration-testingSkill
- iot-embedded-testingSkill
- llm-security-auditSkill
- llm-testingSkill
- localization-testingSkill
- manual-testingSkill
- mcp-testingSkill
- memory-leak-resource-testingSkill
- microservices-testingSkill
- mobile-testingSkill
- mutation-testingSkill
- observability-testingSkill
- payment-ecommerce-testingSkill
- performance-testingSkill
- production-monitoring-synthetic-testingSkill
- property-based-testingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Add logging of env, seed, worker ID, timestamps.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flaky Test Management
A flaky test is a test with different outcomes on the same code. It destroys trust: teams learn to ignore red builds. Treat flakes as bugs with an owner and SLA.
1. Detect & measure
- Re-run failed tests N× on the same commit (
pytest --reruns 3 --only-rerun ...,jest --retryTimes, Playwrightretries), and record every retry-pass as a flake signal — don't just hide it. - Nightly: run whole suite 10–50× (
pytest -p no:randomly --count=20,repeat-eachin Playwright:npx playwright test --repeat-each=20). - Metric: flake rate = flaky runs / total runs per test; alert > 1%. Suite health = % builds red for non-code reasons.
2. Triage decision
| Signal | Likely class | Fix direction |
| Fails only under parallel/CI | Shared state, ports, files, DB rows | Isolate data per test/worker; unique IDs; temp dirs |
| Fails after another test | Order dependence, leaked globals | Randomize order (pytest-randomly, --shard), reset state in teardown |
Timing-dependent (sleep) | Async race | Wait for condition/event, not time (Playwright auto-wait, expect.poll, await eventually) |
| Fails at midnight/month end | Clock | Freeze time (date-time-timezone-testing) |
| Fails on network calls | External dependency | Stub/record (WireMock, MSW, VCR), contract tests |
| Fails with high load | Resource limits | Right-size CI, reduce parallelism, fix leaks |
| Random data | Unseeded RNG | Seed & log the seed |
| Animation/layout (UI) | Visual instability | Disable animations, wait for stable |
3. Bisect the cause
pytest tests/test_x.py::test_y --count=200 -x # reproduce rate
pytest -p randomly -p "randomly_seed=1234" # replay order
npx playwright test --repeat-each=50 --workers=8 --trace on # UI flake with traces
git bisect run sh -c 'pytest -q tests/test_y.py --count=30' # find the introducing commitAdd logging of env, seed, worker ID, timestamps; keep traces/videos on first failure.
4. Quarantine policy
- Tag
@flaky/ move to a non-blocking quarantine job — notskipand forget. - Auto-open a ticket with owner + 7-day SLA; dashboard shows quarantined count.
- Un-quarantine after 50+ consecutive passes; delete tests that can't be stabilised and lack value.
- Retries are a bandage: cap at 1–2, never on the same test more than a week.
5. Prevent
Hermetic tests · unique data per test · explicit waits · no sleep · no shared mutable fixtures · deterministic clocks/RNG · idempotent cleanup · lint rule banning sleep/waitForTimeout.
Related
test-automation, cicd-testing, e2e-testing, concurrency-race-condition-testing, test-metrics-reporting
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

