Skip to content
OpenCppCoverage edited this page Nov 11, 2019 · 4 revisions

Documentation

This plugin provides an integration of OpenCppCoverage into Visual Studio.

The main command can be run by clicking on Tools menu and then OpenCppCoverage Settings. This command opens the Settings window for the startup project. The default shortcut is Ctrl+R, Ctrl+S.

In Tools menu, the command Run OpenCppCoverage directly run OpenCppCoverage for the startup project. It is equivalent to run OpenCppCoverage Settings and click on Run Coverage button. This command does not display the program output. The default shortcut is Ctrl+R, Ctrl+C.

In the Solution Explorer window, from the project contextual menu, you can also run the command OpenCppCoverage Settings and Run OpenCppCoverage. The behavior is the same as described above except the commands use the selected project and not the startup project.

Settings window

  • Current project: The name of the active project defined by the command Set as StartUp Project.
  • Current configuration: Platform Win32 or x64 and Debug or Release configuration.
  • Selected projects: The selected projects for the coverage.
  • Program to run: The default value is defined by the startup project properties, Configuration Properties/Debugging/Command.
  • Arguments: The arguments for the program to run. The default value is defined in Configuration Properties/Debugging/Command Arguments.
  • Working Directory: The working directory for the program to run. The default value is defined in Configuration Properties/Debugging/Working Directory. You must have a write access to allow OpenCppCoverage to generate LastCoverageResults.log file.

  • Optimized Build: Automatically enable OpenCppCoverage optimized build if optimization Disabled (/Od) is not set.
  • Compile before running: If checked, compile the project before running the coverage computation.
  • Reset to default: Reset all settings using the active project defined by the command Set as StartUp Project.
  • Run Coverage: Run the coverage.
  • Close: Close this window.

The command line tab displays the arguments used when running OpenCppCoverage.exe.

For the features available in tabs Filter, Import / Export and Miscellaneous please see Command-line reference.

After running the coverage, you will see the coverage window.

Coverage window

The coverage window displays the coverage results as a tree. You can restrict what files or modules are displayed by using the filter.

When you select a file from the tree, it will be opened inside the Visual Studio editor.

Coverage

If there is a coverage for a file opened in the editor, the coverage is automatically shown. You can disable the display of the coverage by unchecking Display coverage from the coverage window.

You can edit a file that displays its coverage but if you add or remove a line, the coverage is lost. You cannot recover it by undoing your changes.

Clone this wiki locally