-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Request for ability to order/filter test suites and/or tests without changes to underlying test code. #2660
Comments
@padraic working on something that might be of interest to you, too: https://github.com/epdenouden/phpunit/tree/breakfast is a change for PHPUnit that will allow tests to run tests in defects-first mode. It is a followup of the #3092 test reordering feature. |
With the upcoming removal of TestListener it wont be possible to do the filtering that I am currently using Using this at the moment as a way of running tests in parallel in CI environement - so on one machine we do tests 1-10, second machine does 10-20 etc. |
@mcfedr thanks for bringing this issue to my attention by commenting. The TestListener rewrite needs more discussion/experimentation. I've also been looking at inserting a filter to refactor the test reordering. In a few days there's a PHPUnit hackathon, I'll be sure to bring it up |
If its interesting, this, https://github.com/wizaplace/phpunit-slicer, is the code I've been using up to v8, it doesnt work like this because of the |
@sebastianbergmann could you please point to a PR/docs where and how it was implemented? Just don't see any referencing. Thank you. |
It was not implemented. |
@sebastianbergmann was this not implemented as a lack of desire of this feature or would you accept a contribution there? I understand you may not want to keep this ticket around to keep the backlog tidy, but if you would accept this then maybe we would like to keep an issue for it in Infection then. |
In light of #2477 which would remove the current ability to (sneakily, I know!) manipulate test suites within Listeners, this is an issue to request some alternative means of injecting a class with write access. Currently this can be provided within test classes, however there may be some advantage to doing this indirectly as Listeners currently allow.
To explain my own specific needs, a few of us are bringing Humbug back to life, as a mutation testing framework. This involves generating small file changes, and running PHPUnit. We run phpunit for every single change...potentially hundreds of times. To improve performance, we take a number of basic steps described here: https://github.com/humbug/humbug#performance which can be summarised as:
Technically, we only order (or filter) test suites - I'll need to double check if that was a limitation of using Listeners, or of PHPUnit in general, or a limitation in our analysis of code coverage data. We do not order individual tests within a parent suite (unless the children are themselves suites) which would actually be the preferred approach.
The performance benefits are central to the framework being useful, as we are not running all tests all the time hundreds of times.
TL;DR - One way of summarising this is getting an array of tests (which would be multidimensional, grouping tests by suite), manipulating that array, injecting a revised array, all while assuming execution order is simply determined by array index. It could perhaps be done by exporting/importing a name map where avoiding any deeper write level interference with actual objects is preferable.
The text was updated successfully, but these errors were encountered: