views:

101

answers:

3

Hi,

I am using Visual Studio 2008 for a C# WinForms application and I am using the MSTest unit testing framework. It doesn't seem to have test coverage (I think it's in Team System?).

What is the easiest (cheapest?) way to get some test coverage statistics for my project here? Effectively just an indication of for each *.cs file the % test coverage my unit tests are providing, and for the cases when it is not 100% which lines aren't covered.

Thanks

+1  A: 

Have a look at TestDriven.Net. It comes with NCover explorer. While you're about it, have a look at xUnit.net as an alternative to MSTest.

AdamRalph
thanks - my app is pretty basic - is it worth considering xUnit.net?
Greg
A major advantage is that xUnit is free for everyone, while anyone testing your application with MSTest will need the pricier version of Visual Studio to use most of advanced options. But MS continues to put more advance testing features into the base version every release.
kervin
@Greg - the complexity of your app is irrelevant. If you're concerned with simplicity, as well as offering other advantages, xUnit.net is generally cleaner and simpler than MSTest.
AdamRalph
+2  A: 

Try these

http://consultingblogs.emc.com/merrickchaffer/archive/2008/06/13/code-coverage-in-visual-studio-2008-using-test-driven-net-and-team-coverage.aspx

and...

Code Coverage Basics with Visual Studio Team System

If you're using the Test System or Team Suite versions of Visual Studio, it should be straightforward.

kervin
+1  A: 

See SD C# Test Coverage tool. It can provide coverage information reports not only at the file level, but down to the method level and rollups in between. It also provides a nice way to see the actual coverage overlayed on your source text.

Ira Baxter
so you think the report is a bit better than the testdriven.net report then Ira?
Greg
I've only had the briefest exposure to the testdriven.net "report" in the sense of having seen a screen shot. It appears that it also shows coverage data overlayed on source text, in that it will paint at least the line(s?) that are covered. What I do know about hte SD tool is is paints the precise region covered (from starting to ending column) by a probe on a conditional which means it nicely handles multiple conditionals in a line. I can't tell if the testdriven display does that.
Ira Baxter