Everything Matters
Everything Matters

Reputation: 2730

Doubt in Code Coverage Results - VS 2010

I am running code coverage using VS 2010. This is a winform application. In the test settings, using the 'Configure' button, I selected the exe and all the .dlls.

After I run my test, in the code coverage window, I only see the dlls for which there are some tests written. (For eg, I dont see the exe project and some other dlls since there is no tests written for it).

For now, I guess, I am seeing the coverage % for the code that the unit tests are covering. But I want to find out the code coverage for the whole code in my solution. ie, code for which there are no unit tests written. Is this possible or am I missing something in here.

Thanks, Mani

Upvotes: 2

Views: 336

Answers (2)

Everything Matters
Everything Matters

Reputation: 2730

I just found another way to report this. I get the number of lines covered by unit tests and also get total number of lines in the classes from the code metrics in VS. So, a percentage of the number of lines covered by unit tests out of the total number of lines, gives me the percent of code coverage

Upvotes: 0

Shaun Wilde
Shaun Wilde

Reputation: 8358

Most, if not all, profilers will not profile an assembly they don't load as part of the test run. If you want to get coverage of all your assemblies - write a simple test(s) that will load at least one type (class or struct) from each assembly that will force the profiler to load each assembly in your solution and you should get full coverage. Once your test suite is more rounded you will be able to drop this pseudo test.

Upvotes: 2

Related Questions