Skip to content

Dev: Ensure tests are run in random #9968

@paulbalandan

Description

@paulbalandan

PHP Version

8.5.0

CodeIgniter4 Version

4.7.1-dev

Per ChatGPT, tests need to run in random to enjoy the following benefits:

✔️ It reveals hidden dependencies
✔️ Forces true test isolation
✔️ Prevents flaky, misleading test results
✔️ Makes your test suite production-realistic

This issue has been initially tackled by #7717, but due to other complications it didn't fare well. As this is not a fairly easy task, I'm proposing we do it on pieces. Currently, our test suite runs in default order but should be random at some point (i.e., executionOrder="random").

Here's the plan, instead of one big PR changing all tests, we can do it either by component (HTTP, Cache, Database, etc.). Then, after all tests run green on randomised testing, we set executionOrder in phpunit.xml to "random".

Please reference this issue for any PRs addressing pieces of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devhelp wantedMore help is needed for the proper resolution of an issue or pull requesttestingPull requests that changes tests only

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions