I have been working with PHPUnit for a little while now, and it's starting to look like I may need to break my tests up into groups that would run as separate executions of phpunit
. The main reason for this is that most of my tests need to run in separate processes, while some actually cannot be run in separate processes because of an issue documented here. What I would like to do is write a bash script that fires off several executions of phpunit
, each configured to run different tests with different settings.
So my question is: is there a way to aggregate the code coverage results of multiple phpunit
executions? Could I do that directly through PHPUnit itself, or using some other tool? Is it possible to get what I'm looking for out of one run of phpunit
using PHPUnit's test suite concept?
Use the "
--coverage-php
" option to PHPUnit to get it to write the coverage data as a serializedPHP_CodeCoverage
object, then combine them usingPHP_CodeCoverage::merge
, like this:You may also be able to merge the files using a tool named
phpcov
, as described here: https://github.com/sebastianbergmann/phpunit/pull/685