PHPUnit - Remote Code Coverage PHPUnit - Remote Code Coverage selenium selenium

PHPUnit - Remote Code Coverage


The question is a bit dated but just in case it could be useful for anybody else

The way I did it, first of my test case class extends the Selenium Test Case class
It is easier that way so that the test Id is generated and selenium calls the phpunit_coverage.php script automatically at the end of the test
All I needed to do is to grab this id ($this->testId) and send as a cookie in the curl request:
curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID=' . $this->testId);

That way the append/prepend scripts can collect the code coverage stats

if your test case doesn't extends the selenium test case class, you can still generate a unique Id yourself, and then make another curl request to run the phpunit_coverage.php

Hope it helps