Question

I have a simple class library that gets tested with MSTest using VS 2010.

I installed the trial version of dotCover 1.2. with no ReSharper installed.

VS only has the menu items "Cover Startup Project" and "Cover Application". They open boxes where I can open all kinds of applications but no class library.

Is it not possible to calculate code coverage for a class library without another application that uses it?

Was it helpful?

Solution

In my case I have a solution containing a class library, and another solution containing the unit tests.

I wanted to see how much of the class library my unit tests covered. After running Cover Unit Tests from the Solution context menu Dotcover by default shows me the coverage of the methods in the test classes themselves. To see the coverage of the class library you need to unselect Match coverage results with current project structure:

enter image description here

Note that this will only cover class library projects referenced in the tests. If you have a project that doesn't have any tests at all then that project won't show as a symbol in the Coverage Tree.

Thanks to this answer for pointing me in the right direction.

OTHER TIPS

They have a command line tool that can be used without ReSharper: dotCover.exe.

Documentation is not as well as you might expect from jetbrains but it works.

http://blogs.jetbrains.com/dotnet/2010/07/running-code-coverage-from-the-console-with-dotcover/

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