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).


Tarique Sani

Hi, How about doing a screencast or a step by step tutorial - would be cool to learn the trick :)

2008-01-28 10:07 pm


Elizabeth Smith's Blog: Hey, Code Coverage on Windows!...

Elizabeth Smith has posted about a new toy she received from ......

2008-01-29 3:43 am

developercast.com » Elizabeth Smith’s Blog: Hey, Code Coverage on Windows!

[...] Smith has posted about a new toy she received from the folks at Microsoft that adds in a missing piece of development [...]

2008-01-29 5:41 am


Nice! Can I haz a free VS bundle, too?

2008-01-29 1:04 pm

Post a Reply