In this section:
The following instructions assume that [INSTALL_DIR] refers to the DTP Engines for C/C++ installation directory. The default name of this directory is cpptest.
To integrate the Parasoft coverage functionality with MS Build:
You can configure code instrumentation with Property Pages on the level of your project, configuration or parasoft-coverage.props file.
To configure code instrumentation:
Go to Configuration Properties> Parasoft DTP for C/C++ to select the settings from the drop-down menus.
Name | Value | Description |
---|---|---|
DTP Engine Location | [path] | Specifies your DTP Engine for C/C++ location. The default is the value set for your CPPTEST_HOME environment variable. |
Compiler Configuration | [complier configuration] | Specifies the configuration of your compiler. The default is AutoDetect . |
Workspace Location | [path] | Specifies the directory that contains data used to generate the coverage report. The default is your solution directory location. |
Name | Value | Description |
---|---|---|
Line Coverage |
| Allows you to enable or disable collecting coverage during a build. This option is enabled by default. |
Advanced Settings
Name | Value | Description |
---|---|---|
Enable Coverage Optimization |
| Allows you to enable or disable coverage optimization. If enabled, execution time overhead will be reduced. This option is enabled by default. |
Enable Optimized Coverage Corruption Detection |
| Allows you to enable or disable optimized coverage corruption detection. Requires the Coverage Optimization option to be set to If enabled, it allows detection of corrupted coverage memory buffers, which are used when the Coverage Optimization is enabled. This option is disabled by default. |
Enable Coverage Early Initialization |
| Allows you to enable or disable coverage early initialization. If enabled, the process of collecting coverage will start automatically. If disabled, the process must be initiated manually. This option is enabled by default. Contact Parasoft Support for more information about manual initialization of collecting coverage. |
Enable Coverage Auto-Finalization |
| Allows you to enable or disable automatic coverage finalization. If enabled, the process of collecting coverage information will be finalized automatically. If disabled, the process must be finalized manually. This option is enabled by default. Contact Parasoft Support for more information about manual finalization of collecting coverage. |
If the settings selected on the project or configuration level differ from the settings specified on the parasoft-coverage.props level, the project or configuration level settings will have priority and will be used during the build. The settings selected on a given level are in bold, whereas the settings inherited from the higher level are in a regular font. |
To build your code-instrumented application and collect coverage information during a run of the executable:
.clog
file that contains coverage information will be generated in your current working directory. The default name of the file is cpptest_results.clog
..clog
file that contains coverage information will be generated in your current working directory. The default name of the file is cpptest_results.clog
.You can generate coverage reports from the command line or with the Visual Studio DTP Plugin for C/C++
Go to your solution directory.
Run cpptestcli.exe
with the Coverage built-in configuration and the .clog
file as an input. Your command may resemble the following:
cpptestcli.exe -config "builtin://Coverage" -input ATM/Debug/cpptest_results.clog |
Review the XML and HTML coverage reports which are generated in the reports subdirectory of your solution directory.
If your configured workspace location is different than the default solution directory, use the -workspace switch with the path to the directory that is specified as workspace location. |
Enter a new set of parameters in the Arguments field to reconfigure the run:
- ${configuration}
: Uses the test configuration specified in the Parasoft>Configuration settings. Ensure that the active test configuration is set to Coverage.
- -input <path/to/file.clog>
: Specifies the path to the .clog
file that contains coverage information.
- (optional) ${scope}
: Uses the current UI selection to set the scope and allows you to report coverage for individuals projects or files selected in Solution Explorer.
Ensure that your coverage Workspace is the same location as the plugin Working directory. In case the locations are different, provide the |
Run the Coverage built-in configuration on your selected projects.
To uninstall the parasoft-coverage property sheet:
Right-click the selected files and choose Remove from the menu.
The parasoft-coverage.props files will be removed only from the project configurations you selected.