https://github.com/previousnext/phpunit-splitter
PHPUnit tests splitter.
https://github.com/previousnext/phpunit-splitter
php-lib
Last synced: 6 months ago
JSON representation
PHPUnit tests splitter.
- Host: GitHub
- URL: https://github.com/previousnext/phpunit-splitter
- Owner: previousnext
- License: gpl-2.0
- Created: 2023-10-04T22:25:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T01:14:59.000Z (over 2 years ago)
- Last Synced: 2024-12-07T18:36:04.633Z (about 1 year ago)
- Topics: php-lib
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPUnit Test Splitter
Allows you to split your PHPUnit tests by timings.
## Usage
Generate a timing file:
```bash
phpunit --cache-result --results-files=.phpunit.cache/test-results*
```
List your tests:
```bash
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):
```bash
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):
```bash
phpunit-splitter 4 2 --tests-file=tests.xml --results-files=.phpunit.cache/test-results*
```
Pass the results to PHPUnit:
```bash
./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:
```bash
./phpunit-splitter 2 0 --json --tests-file=tests/fixtures/tests.xml --results-files=.phpunit.cache/test-results*
```