layout | title | excerpt | groups | redirect_from | version_added | ||
---|---|---|---|---|---|---|---|
page-api |
QUnit.config.seed |
Enable randomized ordering of tests. |
|
|
1.23.0 |
Enable randomized ordering of tests.
type | `string` or `boolean` or `undefined` |
---|---|
default | `undefined` |
This option is also available as [CLI option](../../cli.md), and as URL query parameter in the browser.
When set to boolean true, or a string, QUnit will run tests in a seeded-random order.
The provided string will be used as the seed in a pseudo-random number generator to ensure that results are reproducible. The randomization will also respect the reorder option if enabled and re-run failed tests first without randomizing them.
Randomly ordering your tests can help identify non-atomic tests which either depend on a previous test or are leaking state to subsequent tests.
If seed
is boolean true (or set as URL query parameter without a value), then QUnit will generate on-demand a new random value to use as seed. You can then read the seed at runtime from the configuration value, and use it to reproduce the same test sequence later.