Hey, Code Coverage on Windows!
MS was nice enough to grant several members of the PHP community (including me) some MSDN licenses which include the “beefed up” versions of Visual Studio which have some additional tools including testing and code coverage.
So this evening I managed to get PHPTrunning my tests (they’re just basic .phpt tests but run-tests is..well flakey is a nice description some days) for my winapi php extension wrapped inside a “generic test” for Visual Studio. It involved writing a semi-clever reporter to output test data in a way that visual studio liked, just fun with xml, getting the command line right for calling the tests, and telling visual studio what dlls I wanted to do code coverage on and making sure the /Profile switch got sent to the linker.
So what did all this accomplish? I now can run my phpt tests through visual studio and collect code coverage on what they’re testing. Like GCOV, only for windows
Nice thing is I can also save xml files with the code coverage data. Tackling this for more of the php source might be a fun project… Makes the mind spin about getting a version of this working so gcov can have windows results too. Here’s my pretty screenshot with coverage highlighting turned on (warning, the thing is huge).

January 29th, 2008 at 3:07 am
Hi, How about doing a screencast or a step by step tutorial - would be cool to learn the trick
January 29th, 2008 at 8:43 am
Elizabeth Smith’s Blog: Hey, Code Coverage on Windows!…
Elizabeth Smith has posted about a new toy she received from ……
January 29th, 2008 at 10:41 am
[…] Smith has posted about a new toy she received from the folks at Microsoft that adds in a missing piece of development […]
January 29th, 2008 at 6:04 pm
Nice! Can I haz a free VS bundle, too?