Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for phpunit --order-by #502

Closed
Petah opened this issue Aug 6, 2020 · 5 comments
Closed

Support for phpunit --order-by #502

Petah opened this issue Aug 6, 2020 · 5 comments

Comments

@Petah
Copy link

Petah commented Aug 6, 2020

Does paratest support functionality like phpunit's order-by? I would like my tests to run in a random order, fastest first, etc

  --order-by=<order>          Run tests in order: default|defects|duration|no-depends|random|reverse

https://phpunit.readthedocs.io/en/9.2/textui.html?highlight=%22order-by%22#command-line-options

Thanks.

@Slamdunk
Copy link
Member

Slamdunk commented Sep 8, 2020

As of yet, there's no plan to support --order-by: some order requires the PHPUnit cache, which we cannot easily support, some order requires a SUT listener, which we cannot support at all, other orders are weird to me - what would be the benefit or random order in the parallelization context where tests are already started with no particular consequentiality?

@weirdan
Copy link

weirdan commented Sep 8, 2020

Random order is useful to ensure that tests have no hidden dependencies between them.

@Slamdunk
Copy link
Member

Slamdunk commented Sep 8, 2020

What we can do is running each PHPUnit process with --cache-result --cache-result-file=/tmp/random, merge back together the results and in subsequent ParaTest runs use it to provide almost all the order-by PHPUnit gives.

What I don't like is that it would reflect PHPUnit behavior only in ParaTest --functional mode, which is supported only by Runner: WrapperRunner could use only a part of PHPUnit behavior since it can only run a full test class on its default order, unless adding some logic to store the specific cache file and give it back to the subprocess.

The only easy order to implement is random one since it doesn't need a previous run: few randomizer on SuiteLoader class and a --order-by random passthru should suffice. This implementation by the way is only needed to uncover hidden dependencies between different test classes: you are already able to --passthru="--order-by random" to uncover hidden dependencies within test cases of the same test class.

All in all, I see a quite lot of code to add and maintain for a little gain.

@proggga
Copy link
Contributor

proggga commented Oct 19, 2020

I think we can close in some way this task, We added default, random, reversed types, and --random-order-seed for failure reproduce

@Slamdunk
Copy link
Member

Closed by #539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants