Code Coverage
Improving Software Quality with Code Coverage in CppDepend
CppDepend integrates code coverage data to help you identify untested code, measure test effectiveness, and improve overall software quality. This section explains how to configure and import coverage data from various sources.
Supported Coverage Technologies
CppDepend can import coverage data from:
- Bullseye coverage files
- Cobertura
- Visual Studio Team System
- CTC++
XML Coverage Files from Visual Studio
Visual Studio has 2 coverage file formats.
- A binary format where file extension is .coverage. This is the format you'll get from testing from Visual Studio. Alternatively you can also use the tool VSPerfMon.exe to get a .coverage file. For that you then need to instrument each project to cover with the tool VSInstr.exe used with the /Coverage option.
- A XML format (with file extension .coveragexml since VS 2010, and .xml for previous versions)
CppDepend only consumes the XML format. You can manually export XML coverage files from binary coverage files from Visual Studio with this option:

See the code snippet below, it takes 3 lines of code to programmatically transform a binary coverage file into a xml coverage file.
- For that you'll need to reference from your project the assembly Microsoft.VisualStudio.Coverage.Analysis.dll:
- A x86 version of this DLL can be found under C:\Program Files (x86)\Microsoft Visual Studio XX.0\Common7\IDE\PrivateAssemblies
- A x64 version of this DLL can be found on x64 server where TFS is installed under C:\Program Files\Microsoft Team Foundation Server XX.0\Application Tier\TFSJobAgent\Plugins
- Both System.Data and System.Data.DataSetExtensions will have to be referenced as well.
- And if you want your code to be independent from any VS or TFS install, you'll need to deploy as well Microsoft.VisualStudio.Coverage.Interop.dll that is used by Microsoft.VisualStudio.Coverage.Analysis.dll.
XML Coverage Files from CTC++
You can use the Ctc2cob tool which converts Testwell CTC++ reports into Cobertura-like XML reports.
Coverage Files Configuration
In VisualCppDepend menu: Project Properties > Analysis > Code Coverage > Settings

Import Coverage Data
In VisualCppDepend menu: Coverage > Import Code Coverage Data
or
In VisualStudio menu: CppDepend > Coverage > Import Code Coverage Data

Try CppDepend Today
Start your 14-day free trial with full access to all documentation features. No credit card required.
