Visual Code Coverage with SimpleTest

… and a little bit help of PHPUnit2.

For our CMS, we use SimpleTest as testing framework. We used it in other projects, and as you should never change a running team, we sticked to that for Flux CMS as well. And the WebTesting classes are just great for something webbased (besides the “traditional” unit test classes provided by SimpleTest).

But one thing I saw over at PHPUnit2 and badly wanted to have, was the Code-Coverage Analysis. The pure coverage data comes from Xdebug PHPUnit2 “just” displays it nicely based on that. A quick look into the code revealed that it was easy to just use the CodeCoverage classes and so I integrated it in our testing framework. The output looks then something like this:


As you can see, we almost covered all lines of the makeUri method :)

And the needed code for adding CodeCoverage output basically was:

Thanks for the great jobs to Sebastian, Derick and Marcus. And Andreas for the glue of the testing framework.

Great! Thanks!
Note: For linux users the fist parameter of ‘ factory’ must be ‘HTML’ (in uppercase).

Any Idea if you can release a patch for selenium or a downloadable piece of code ?

In which file(s) did you need to add the code for the CodeCoverage output?

Sorry if this is a stupid question. I’m still trying to wrap my head around OO PHP, testing, coverage, using Aptana and SimpleTest, and the Zend Framework. =]

Andrew: That was a long time ago, I really can’t remember.

Search for
$ret = $psuite->run($preporter);
somewhere in your code and you maybe find it :)

hi , where can i put this code in the simpletest framwork ?