What is code coverage?

Code coverage is a measure used in software testing that describes the degree to which the source code of a program has been tested. The analysis finds the following areas

 Finding areas of a program not exercised by a set of test cases

 Where developers need to create more test cases to increase the coverage

Code coverage doesn't directly help you write better code, but it does help you write better tests, which in turn help you write better code. Code coverage will uncover execution paths that are not being exercised by your tests.

Code coverage Instrumentation

Code coverage is a feature available in Visual Studio Team Edition for developers, testers and in Team suite also. Visual Studio uses block based statement (also known as C1 coverage) and condition coverage methodology. A block is commonly defined as a sequence of instructions that have a single entry point and a single exit point. We can consider an exit point to be a branch instruction, a function call, a return instruction or a throw instruction.

To get the coverage of source code, the test assemblies need to be instrumented by having MSTest.exe in place with MSBuild commands or through VSTS instrumentation options. Once the instrumentation is done the coverage file will be available for getting reports out of it.

VSTS is capable of opening the coverage file but if you want to open in some other reporting tool, you should convert the coverage file to the intended format of that reporting tool.

Ref: http://msdn.microsoft.com/en-us/library/ms182534(VS.80).aspx


XTCover – An Intro

It stands for eXTreme COVERage, a web based .NET code coverage reporting tool. It provides the coverage summary in an enhanced way by using web technologies such as ASP.NET 3.5, Silverlight 3 to reveal very decent look and feel and user friendly navigation options. The main intention of this tool is that developers can be focused on the code areas where they should give more attention to increase the coverage of the source code.

The tool can be integrated with continuous integration process or leverage as a stand-alone coverage reporting tool. Besides that the tool is capable of automating MSTest coverage instrumentation process.See the other Project netbuildconfigurator for how to use these details report in ContinousIntegration process.This tool Provides Architects a quick and effective look at the coverage Details.

The input of this tool is the Coverage.xml generated from VSTS CodeCoverage or other Sources and Provide meaningful and effective Reporting to analyse the Code Coverage.

A new Video is Uploaded now which Demonstrate the Configuration part ,Soon We will upload more Screencasts which talks about the Architecture and Code Walk through.


Features of the tool

1. Capable of MSTest instrumentation and creation of coverage source based on required parameters (VSTS license is required)

2. Developers can choose their specific coverage source for reporting

3. Easy navigation to show coverage statistics, aggregates and graphs for module, namespace, class, method and line level

4. Tag cloud reports from module or package to class level

5. Source code display for respective classes and methods and highlighting covered / non-covered / partially covered lines of code

6. User will be focused to specific line level by selecting method names

7. Tool can be integrated with Continuous Integration process or can be used as a stand-alone product

XTCover Dashboard Look and Feel :-
Xtcover.png

XtCoverReport2.png

XtCoverReport3.png

XtCoverReport4.png

XtCoverResult.png

XTCover features comparison :- see the code section

A new Video is now Uploaded to the Site Which Demonstrate Configuration needed for this tool.

Next version :- This version which work on VS2k8 does not use the codecoverage api improvements like VS2010.The next version will contain the API improvement.
Described here http://blogs.msdn.com/phuene/archive/2009/12/01/programmatic-coverage-analysis-in-visual-studio-2010.aspx

Related Articles

http://social.msdn.microsoft.com/forums/en-US/tfsbuild/thread/9d7ce662-3539-4dc7-a007-cf57ad2ef859/

http://arcware.net/executing-vsts-unit-tests-and-code-coverage-from-the-command-line/

*Also see My blog post @http://shreeman.spaces.live.com

Please Submit your feedback on this tool.

Last edited Feb 26, 2010 at 4:16 PM by sndshreeman, version 9