---
title: "Find flaky tests before they merge · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/repeat-new-tests
updated: 2026-10-20
licence: "All rights reserved"
---

# Find flaky tests before they merge

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Flaky and slow tests](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests)
- Rule: Run new and changed tests many times in a row before merging, to catch flakiness while the change is fresh.
- How: In the pull request build, run only the changed test files several times, for example with Playwright `--repeat-each=10` or pytest-repeat `--count=10`. A test that fails once in ten runs is not ready.
- Check: The pull request job repeats changed tests and fails if any run fails.

Example:

```sh
npx playwright test tests/e2e/checkout.spec.ts --repeat-each=10
pytest tests/test_checkout.py --count=10
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/repeat-new-tests`.

- Previous: [Quarantine flaky tests with an owner](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/quarantine-flaky-tests)
- Next: [Keep the suite within a time budget](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/suite-time-budget)
- [Flaky and slow tests](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests)
