---
title: "Find hidden order dependencies · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/random-order
updated: 2026-10-20
licence: "All rights reserved"
---

# Find hidden order dependencies

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 tests in a random order, so tests that depend on each other fail early.
- How: Turn on random order in the runner, such as Vitest `--sequence.shuffle`, Jest `--randomize`, pytest-randomly or PHPUnit `--order-by=random`. Print the seed, or set it yourself, so a failing order can be run again.
- Check: The test command shuffles the order and logs the seed. Running it again with that seed repeats the same order.

Example:

```sh
npx vitest run --sequence.shuffle --sequence.seed=20261020
npx jest --randomize --seed=20261020
pytest -p randomly --randomly-seed=20261020
```

**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/random-order`.

- Next: [Quarantine flaky tests with an owner](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests/quarantine-flaky-tests)
- [Flaky and slow tests](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests)
