Main Content

Coverage metrics (-cov-metric-level)

Specify level of code coverage metric calculation

Since R2023b

Description

Polyspace® Test™ calculates different code coverage metrics depending on the level of calculation that you specify.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Testing & Profiling tab, select the Code Coverage node and then select a value for this option.

  • Command line: Use the option -cov-metric-level. See Command-Line Information.

Why Use This Option

Depending on your application, you can streamline your workflow by choosing the appropriate level of calculation for code coverage metrics.

Settings

Default: decision

statement

Enables the calculation of these code coverage metrics:

decision

Enables the calculation of these code coverage metrics:

condition/decision

Enables the calculation of these code coverage metrics:

mcdc

Enables the calculation of all code coverage metrics (excluding relational boundary coverage, which requires specifying additional options). For details about supported code coverage metrics, see Review Code Profiling Results.

none

Disables the calculation of all the code coverage metrics.

Dependencies

To select a code coverage level, you must select Code Coverage as the Type of profiling.

Command-Line Information

At the command line you can select coverage metrics by using either the polyspace-code-profiler command or the polyspace-test command. If you have a *.psprjx project, use the polyspace-test command. If you are profiling xUnit tests, use the polyspace-code-profiler command.

polyspace-code-profiler

Parameter:-cov-metric-level
Default:decision
Example: polyspace-code-profiler -instrument -instrum-dir instrumFolder -cov-metric-level decision -- compileCommand

polyspace-test

Parameter:-cov-metric-level
Default:decision
Example (code coverage): polyspace-test -run -project pathToproject -profiling-mode coverage -cov-metric-level mcdc

Version History

Introduced in R2023b