Before starting a coverage analysis, you specify several coverage recording options. On the Apps tab, select Coverage Analyzer.
On the Coverage pane in the Configuration Parameters dialog box, set the options for the coverage calculated during simulation.
Gather specified coverage results during simulation and report the coverage. When you select Enable coverage analysis, these sections become available:
Specifies the systems for which the software gathers and reports coverage data. The options are:
You must select Enable coverage analysis to specify the scope of analysis.
By default, generates coverage data for the entire system. The coverage results include the top-level and all supported subsystems and model references.
Coverage analysis records the coverages for the referenced models
that you select. By default, generates coverage data for all
referenced models where the simulation mode of the Model block
is set to Normal
, Software-in-the-loop
(SIL)
, or Processor-in-the-loop (PIL)
.
To specify the referenced models for which the Simulink® Coverage™ software records coverage data:
In the Configuration Parameters dialog box, on the Coverage pane, select Enable coverage analysis.
Click Select Models.
In the Select Models for Coverage Analysis dialog box, select the referenced models for which you want to record coverage. You can also select the top-level model.
The icon next to the model name indicates the simulation mode
for that referenced model. You can select only referenced models whose
simulation mode is set to Normal
, SIL
,
or PIL
.
If you have multiple Model blocks that reference the same model and whose simulation modes are the same, selecting the check box for that model selects the check boxes for all instances of that model with the same simulation mode.
To close the Select Models for Coverage Analysis dialog box and return to the Configuration Parameters dialog box, click OK.
Coverage analysis records coverage during simulation for the subsystem that you select. By default, generates coverage data for the entire model. To restrict coverage reporting to a particular subsystem:
In the Configuration Parameters dialog box, on the Coverage pane, select Enable coverage analysis.
Click Select Subsystem.
In the Subsystem Selection dialog box, select the subsystem for which you want to enable coverage reporting and click OK.
The Include in analysis section contains two options:
MATLAB files enables coverage for any external functions called by MATLAB® functions in your model. You can define MATLAB functions in MATLAB Function blocks or in Stateflow® charts.
To select the Coverage for MATLAB files option, you must select Enable coverage analysis.
C/C++ S-functions enables coverage for C/C++ S-Function blocks in your model. Coverage metrics are reported for the S-Function blocks and the C/C++ code in those blocks. For more information, see Generate Coverage Report for S-Function.
You must select Enable coverage analysis to select the Coverage for S-Functions option.
Select the structural coverage level and other types of test case coverage analysis that you want the tool to perform (see Types of Model Coverage). The Simulink Coverage software gathers and reports those types of coverage for the subsystems, models, and referenced models that you specify.
The structural coverage levels are listed in order of strictness of test case coverage analysis:
Block Execution
—
Enables Execution Coverage (EC)
Decision
— Enables Execution Coverage (EC) and Decision Coverage (DC)
Condition Decision
— Enables
Execution Coverage (EC), Decision Coverage (DC), and Condition Coverage (CC)
Modified Condition Decision Coverage
(MCDC)
— enables Execution Coverage (EC), Decision Coverage (DC), Condition Coverage (CC), and Modified Condition/Decision Coverage (MCDC)
Coverage metrics also includes Other metrics:
You must select Enable coverage analysis to select the coverage metrics.
On the Coverage > Results pane in the Configuration Parameters dialog box, select the destination for coverage results. You must select Enable coverage analysis on the Coverage pane to set the Coverage > Results pane options.
After simulation, shows the results explorer.
After simulation, colors model objects according to their level of coverage. Objects highlighted in light green receive full coverage during testing. Objects highlighted in light red receive incomplete coverage. See View Coverage Results in a Model.
If you use the toolbar buttons to simulate a model with coverage enabled, this setting is not honored and the model coloring for coverage results always appears after each simulation. You can click Highlight model with coverage results in the Results Explorer to enable or disable model coverage highlighting. You can access the Results Explorer from the Simulink Coverage contextual tabs, which appear when you open the Coverage Analyzer app, under Model Verification, Validation, and Test. For more information, see Accessing Coverage Data from the Results Explorer.
Specifies whether to open a generated HTML coverage report in a MATLAB browser window at the end of model simulation.
Saves the results of the last simulation run in a cvdata
object
in the workspace. Specify the workspace variable name in cvdata
object name.
Name of the workspace variable where the results of the last
simulation run are saved. You must select Save last run
in workspace variable to specify the cvdata
object
name.
Appends numerals to the workspace variable names for each new result so that earlier results are not overwritten. You must select Save last run in workspace variable to enable this option.
Name of file to which coverage data results are saved. The default
name is $ModelName$_cvdata
. $ModelName$
is
the name of the model.
The folder where the coverage data is saved. The default location
is slcov_output/$ModelName$
in the current folder. $ModelName$
is
the name of the model.