previousnext / phpunit-splitter
Splits phpunit tests
Installs: 1 058
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 7
Forks: 0
Open Issues: 1
Type:project
Requires
- php: ^8.1
- ext-simplexml: *
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-phpunit: ^1.4
- symfony/console: ^6.3|^7.2
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12.19
- phpunit/phpunit: ^10.5.45
- previousnext/coding-standard: ^1.1.1
- staabm/annotate-pull-request-from-checkstyle: ^1.8
This package is auto-updated.
Last update: 2025-02-25 03:11:58 UTC
README
Allows you to split your PHPUnit tests by timings.
Usage
Generate a timing file:
phpunit --cache-result --results-files=.phpunit.cache/test-results*
List your tests:
phpunit --list-tests-xml=tests.xml
This generates an XML file with a list of tests. You can add --testsuite
to limit the tests to a specific suite.
Split the tests in 2 groups and get the first group (0):
phpunit-splitter 2 0 --tests-file=tests.xml --results-files=.phpunit.cache/test-results*
Split the tests in 4 groups and get the third group (2):
phpunit-splitter 4 2 --tests-file=tests.xml --results-files=.phpunit.cache/test-results*
Pass the results to PHPUnit:
./phpunit-splitter 2 0 --tests-file=tests/fixtures/tests.xml --results-files=.phpunit.cache/test-results* | xargs ./vendor/bin/phpunit done
Output the test list as JSON:
./phpunit-splitter 2 0 --json --tests-file=tests/fixtures/tests.xml --results-files=.phpunit.cache/test-results*