Question

I'm running VS2008's Code Coverage against a unit-tested DLL that I'm developing. For some of the functions it claims that 2 blocks are not covered and 50 or so are. When I view the function with the VS2008 highlighting it can't find the uncovered blocks.

The highlighting appears to work with some functions though as it correctly shows a different color for uncovered blocks. Seems to be inconsistent.

Is this a bug or PIBKAC? If the latter, what am I doing wrong?

Was it helpful?

Solution

I've seen some issues where the code coverage analyzer has trouble with closing braces on try/catch blocks. When I see these sorts of things, I just don't worry about it -- as long as I can see that the actual code gets covered.

[EDIT] I'd second the TestDriven.NET recommendation. I like it for the right-click test menus that let me easily run individual tests and I also use NCover rather than the built-in coverage -- mostly because it opens in another window and doesn't color the text in my main editor.

OTHER TIPS

Just a suggestion, try the code coverage tool from TestDriven.Net and compare the results.

Make sure to differentiate between covered blocks and partly covered blocks. The color is similar in the default settings, if i recall correctly.

I had a situation in which a switch statement that chose a different path for every member of an enumeration didn't have a "default" path. You could spot the not-completely-covered block by the parens of the switch statement not being highlighted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top