jeudi 7 juillet 2016

PHPUnit: combine code coverage from two executions

I have multiple testsuites for one project which I would normally run by executing phpunit with no arguments. I do it this way so that I get a single report showing total code coverage for all tests.

The problem I have encountered is that I now want to run a batch script at the start of one of the test suites, and the only way I can think to do this is to execute phpunit multiple times (from a shell script), and call my batch script at the appropriate point. This would mean that the resulting report would show coverage for the last test suite only, which is not what I want.

How can I insert a batch script into the execution and still generate a single code coverage report?

I could use setUpBeforeClass() and a static flag to check whether the batch script had been run previously, but I would prefer to avoid this if I could.

Aucun commentaire:

Enregistrer un commentaire