sebastianbergmann/phpunit — Issue #417: Selenium tests cannot generate code coverage for their current process
Author: giorgiosironi
Created: 2011-11-22 16:59:54+00:00
State: open

Due to this line in PHPUnit_Framework_TestResult:

--- a/PHPUnit/Framework/TestResult.php
+++ b/PHPUnit/Framework/TestResult.php
@@ -601,7 +601,6 @@ class PHPUnit_Framework_TestResult implements Countable

$useXdebug = self::$useXdebug &&
$this->codeCoverage !== NULL &&
- !$test instanceof PHPUnit_Extensions_SeleniumTestCase &&
!$test instanceof PHPUnit_Framework_Warning;

Selenium test cases cannot generate a code coverage for the code they execute in the current process. This would be useful for two reasons:
- Selenium tests can use a backdoor to manipulate the state of the application before accessing it via the browser, or to assert it afterwards. For example, they may set up a database table's content or checking the result of some query. This code coverage does not show up in the report.
- obtaining code coverage from the test suite of PHPUnit_Selenium.
I don't know if just removing the line is the right solution, but works for me on PHPUnit_Selenium.