DX: Use ParaUnit to speed up tests#6883
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
b86866b to
df6fc50
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
FYI: Test execution comparison, run locally on MacBook Pro M1, without smoke tests (466 test classes, 33572 tests):
ParaUnit is 2x faster than regular PHPUnit using Fast Linter ( |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
FYI: about This test is not a part of Let's sum it up:
Everything is correct 🙂. It's not optimal, since 98% of test classes in Auto Review job are run for nothing, but the result is OK. Same with tests mentioned here - these 2 classes are from group |
|
|
||
| - name: Collect code coverage | ||
| if: matrix.calculate-code-coverage == 'yes' | ||
| run: vendor/bin/paraunit coverage --testsuite coverage --exclude-group covers-nothing --clover build/logs/clover.xml |
There was a problem hiding this comment.
did you tried to compare results of coverage generated by PHPUnit and by paraunit? what's the difference?
There was a problem hiding this comment.
No, I did not verify it, but I'll do it 👍.
There was a problem hiding this comment.
In terms of coverage it looks like everything works as it should:
There was a problem hiding this comment.
i have the feeling that number should not be different.
There was a problem hiding this comment.
The number is different because the code is having global state, e.g. https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.21.1/src/Tokenizer/CT.php#L99-L104 - running it with PHPUnit make that if covered (or not covered) all the time with the same result, ParaUnit make it non-deterministic.
If you run PHPUnit like ./vendor/bin/phpunit --order-by=random you will get slightly different coverage for each run.
|
I find this very confusing. Maybe we could at least document it in codebase (not only in PR) ? numbers diff is impressive 👍🏻 |
| "symfony/stopwatch": "^5.4 || ^6.0" | ||
| }, | ||
| "require-dev": { | ||
| "facile-it/paraunit": "^1.3 || ^2.0", |
There was a problem hiding this comment.
tbh, I never heard about it.
when thinking about parallel execution of PHPUnit, somehow I always had in mind https://github.com/paratestphp/paratest , and to my understanding maintainer of it, Slamdunk, is also more close to PHPUnit itself.
would you mind to share this and that about 2 solutions and arguments for decision?
There was a problem hiding this comment.
Hi, Paraunit creator here. Paratest was in disuse when I created Paraunit, but Slamdunk took it over later and revived it. Now it has been used into Laravel, hence the growing popularity.
The main difference between the two tools is basically in the approach: Paratest is "hand on", uses @internal components of PHPUnit and has a tighter integration with it (hence some additional capabilities like being able to hook into specific output formats or being able to filter by groups); Paraunit is "hands off", just executes PHPUnit from the outside, hence the simpler integration but less functionality.
BTW I know Slamdunk and he even invited me to co-maintaint Paratest, but I have to admit I'm not so well versed in it.
There was a problem hiding this comment.
Thanks for the details!
side note: yeah, it could be interesting to have the parallel executor available, instead of few possibilities. I could suggest one step further - consider to incorporate it to PHPUnit natively [I know Sebastian wanted to have some internal cleanups first, but if I recall right, lot of them already in place]
@keradus let's finish #6839, then such change would be transparent to users because Composer script would switch from PHPUnit to ParaUnit and everything would work as we expected 🙂. This is advantage of that PR, which I'm fighting for for months 😆. |
Symfony bumped minimal PHP version in 6.1 and to satisfy ParaTest we need to enforce it too.
See issue 749 in `paratestphp/paratest` (link removed in order to not pollute issue with PR references).
Pull Request Test Coverage Report for Build 5474591896
💛 - Coveralls |
This reverts commit 7d34e69.
This reverts commit 7d34e69.
This reverts commit 7d34e69.
Currently test suites in Github Actions take ages. This PR's goal is reducing time needed for running test suite(s).
Initially started with ParaTest, but after encountering problems with test loader I've changed to ParaUnit.
Benchmark: