[xdebug-general] coverage not reported on code being executed

From: Mark Slater <lists[@]humanesoftware.com>
Date: Tue, 4 Sep 2007 17:07:02 -0700

I've just added unit tests and XDebug to the project I'm working on
and for the most part I'm very pleased. But I've got two problems,
one of which is serious and the other is annoying.

Serious problem: XDebug is reporting 0 executions on a function I
know is being executed during the tests. Just to be sure, I added an
"echo" statement to the function and during the tests, it echos away.
What's worse is that another function (called by the first one
several times during each execution) has no numbers next to it (other
than the line number). I added an "echo" statement to this second
function as well and see it printed many times during the unit tests.
Other functions called by test cases in the same file are being
registered in the code coverage, but these two functions that are
being skipped are significant because they are part of our core
functionality and really need to be tested and reported.

Annoying problem: Our product is a web application. That means that
some variables aren't filled in unless the code is in a web request.
But when I try to have coverage reported over the whole product, it
seems that XDebug tries to execute each line because it fails on
things like:

     [PHP Error] Undefined index: SERVER_PORT [line # of /path/to/
file.php]

Is there anyway to get around that? Our unit tests are intended for
offline execution, but if XDebug is going to insist that all lines be
executable (even ones our tests won't actually touch) then it
severely reduces our ability to use it outside a rather limited set
of files.

Thanks for your help!

Mark
Received on Wed Sep 05 2007 - 02:25:20 BST

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST