View Issue Details

IDProjectCategoryView StatusLast Update
0001154XdebugCode Coveragepublic2020-03-12 17:35
Reporterstof Assigned Toderick  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionduplicate 
Summary0001154: Provide a way to configure excluded paths from the code coverage
Description

Enabling the code coverage adds a huge overhead to the test execution, especially since Xdebug 2.3 (see http://bugs.xdebug.org/view.php?id=1123).

The common usage of code coverage in PHPUnit involves the filtering of directories in which the code coverage should be reported, because we don't care about the coverage inside our own tests or inside our dependencies.
However, the current behavor is that XDebug collects everything (with overhead) and that PHPUnit drops part of the collected data afterwards (potentially most of the collected data in case of functional tests involving lots of code from the dependencies).
It might be better to have a way to configure XDebug to ignore the code coverage for some paths, avoiding the overhead for all this code.
I don't how how XDebug works internally, so I don't know whether this is possible, but here is how things could look like:

<?php

xdebug_filter_code_coverage(function ($filename) {
// Implement some logic here to decide whether the file should be analyzed

return true;

});

xdebug_start_code_coverage();

For backward compatibility, the default behavior when no callback is specified would of course be to collect coverage in all files.

TagsNo tags attached.
Operating System
PHP Version5.6.0-5.6.4

Activities

sebastian

2015-05-27 11:33

reporter   ~0003088

I already proposed in http://bugs.xdebug.org/view.php?id=1144 to move the blacklist / whitelist filtering from PHP_CodeCoverage to Xdebug for performance.

Before the first test is run, PHPUnit knows which files it is interested in (whitelist) or not interested in (blacklist). I think it would be best to pass this list once to Xdebug and use it for all xdebug_start_code_coverage() / xdebug_end_code_coverage() iterations instead of invoking a callback each time.

derick

2015-05-30 20:04

administrator   ~0003101

Duplicate of 0001144.

Issue History

Date Modified Username Field Change
2015-05-26 09:22 stof New Issue
2015-05-27 11:33 sebastian Note Added: 0003088
2015-05-30 20:04 derick Note Added: 0003101
2015-05-30 20:04 derick Status new => closed
2015-05-30 20:04 derick Assigned To => derick
2015-05-30 20:04 derick Resolution open => duplicate
2020-03-12 16:55 derick Severity minor => feature
2020-03-12 17:35 derick Category Feature/Change request => Code Coverage