Skip to content

Dev: Ensure tests are run in random #9968

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 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.

Activity

  1. added
    help wantedMore help is needed for the proper resolution of an issue or pull request
    testingPull requests that changes tests only
    on Feb 20, 2026
  2. deleted a comment from mergeable on Feb 20, 2026
  3. deleted a comment from mergeable on Feb 20, 2026
  4. neznaika0 commented on Feb 20, 2026

    @neznaika0
    Contributor

    I also mentioned the randomization of tests, the answer was the same - it takes a lot of time.

    I can't imagine how to edit Database tests, this is the most difficult stage.

  5. paulbalandan commented on Feb 20, 2026

    @paulbalandan
    MemberAuthor

    I also think randomising database tests would be the most difficult piece.

  6. pinned this issue on Feb 22, 2026
  7. paulbalandan commented on Apr 13, 2026

    @paulbalandan
    Author
  8. jalexiscv commented on May 18, 2026

    @jalexiscv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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