Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aggregating code coverage from different testing frameworks

In modern programming workflow numerous testing frameworks are used at once. For example, in PHP world, it is de-facto standard way to use unit tests, integration tests and functional/acceptance tests at once. Most of the time different frameworks are used for different test type. I am using combination of PHPSpec for unit, PHPunit for integration and CodeCeption for functional tests.

Is it possible to aggregate code coverage results that each of these frameworks return? Is there any tool that aggregates code coverage reports from different frameworks? Or it is only possible to view individual results for each framework while they are incorrect because each code coverage report doesn't take into account other tests.

like image 560
RuslanN Avatar asked Oct 07 '15 00:10

RuslanN


1 Answers

It is actually quite simple to perfrom this task. All your frameworks rely on the same library to generate the code coverage.

As you can see the generator in sebastianbergmann/php-code-coverage already supports a merge function (line 335) to merge different aggregates. Since you are part of a team using tests I assume it will be easy for you to change the test execution layer slightly to gather the code coverage in a single php process and just merge em.

like image 158
FloydThreepwood Avatar answered Oct 17 '22 20:10

FloydThreepwood