Randomize test runs
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
[](https://oss.issuehunt.io/r/avajs/ava/issues/595)
We should kick off tests in a random order. This will flush out any interdependencies per test. However the order should be reproducible to debug such interdependencies. Ruby's minitest has a [`--seed` option](https://github.com/seattlerb/minitest#running-your-tests) which can be set on the CLI to control the order. A random seed is used if no value is provided and it's reported in the output.
Starting tests in a random order within a test file is the easiest place to start. Presumably `.serial` would run in source order.
We could consider running test files in a random order as well, though they're already somewhat random because each test file runs in its own process, and because each test file runs in its own process it'd be hard to run them in a deterministic order. So probably best not to even try.
Thoughts?
---
IssueHunt Summary
### Backers (Total: $80.00)
- [ issuehunt](https://oss.issuehunt.io/u/issuehunt) ($80.00)
### Submitted pull Requests
- [#3442 Add seeded test order randomization](https://oss.issuehunt.io/r/avajs/ava/pull/3442)
- [#3458 Add seeded test order randomization](https://oss.issuehunt.io/r/avajs/ava/pull/3458)
---
#### [Become a backer now!](https://oss.issuehunt.io/r/avajs/ava/issues/595)
#### [Or submit a pull request to get the deposits!](https://oss.issuehunt.io/r/avajs/ava/issues/595)
### Tips
- Checkout the [Issuehunt explorer](https://oss.issuehunt.io/r/avajs/ava/) to discover more funded issues.
- Need some help from other developers? [Add your repositories](https://oss.issuehunt.io/r/new) on IssueHunt to raise funds.
Contributor guide
Research direction
Review submitted PRs #3442 and #3458 first, then trace the test runner's CLI handling and per-file test execution path. The intended result is randomized test order within a file, a reproducible and reported seed, source order for `.serial`, and no attempt to randomize test files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100