Types of Coverage Reports
Simulink® Coverage™ can create coverage reports for a model, some model elements, and for code integrated into a model or code generated from a model. To generate a coverage report, use one of the following methods:
Click the Run (Coverage) button to simulate the model. When the simulation completes, you see the coverage report open in the Coverage Details pane.
On the Coverage tab, click Results Explorer. Use one of the following two methods to generate a coverage report using the Coverage Results Explorer:
Click Highlight model with coverage results to highlight the model and open the Coverage Details pane.
Click Generate report to create a standalone report that can be viewed separately from the Simulink model.
Use one of these method when you have coverage results but do not see the Coverage Details pane, such as when loading coverage results from a file.
Use
cvhtml
if you generate or load your coverage data programmatically.
Report Type | Description | HTML Report File Name |
---|---|---|
Top-Level Model Coverage Report | Provides coverage information for all the model and its model elements. |
|
Model Summary Report | Provides links to coverage results for referenced models and external MATLAB® files in the model hierarchy. Created when the top-level model includes Model blocks or calls one or more external files. |
|
Model Reference Coverage Report | Created for each referenced model in the model hierarchy. This report has the same format as the top-level model coverage report. |
|
External MATLAB File Coverage Report | Provides detailed coverage information about the MATLAB files that the model calls. There is one report for each external file. |
|
Subsystem Coverage Report | Provides coverage results for the selected subsystem. | , where
model_name is the name of the top-level
model |
Code Coverage Report | Provides coverage information for C/C++ code in custom code blocks and models in SIL mode. | ,
or
|
Model Summary Report
If the top-level model contains Model blocks or calls external files,
Simulink
Coverage creates a model summary coverage report named
.
The title of this report is Coverage by Model.model_name
_active_summary_cov.html
The model summary report lists and links to the coverage reports for the referenced models and external files called by the MATLAB code in the model. For more information, see External MATLAB File Coverage Report.
When you click a link from the Coverage Details pane, you can use the Return to Model Summary Report link to return to the top-level report.
This graphic shows an example of a manually generated model summary report. It
contains links to the model coverage report (mExternalMfile
), a
report for the Model block (mExternalMfileRef
), and three external
files called from the model (externalmfile
,I
externalmfile1
, andexternalmfile2
).
Model Reference Coverage Report
If your top-level model references a model in a Model block, the
software creates a separate model reference report, named
,
that includes coverage for the referenced model. This report has the same format as the
Top-Level Model Coverage Report and does not indicate that the model is referenced
in a Model block.reference_model_name
_cov.html
External MATLAB File Coverage Report
If your top-level model calls any external
MATLAB files, you can enable the external MATLAB file coverage report by selecting MATLAB files on the Coverage pane in the
Configuration Parameters dialog box. The software creates a report, named
, for
each file called from the model. When the model makes several calls to a given file, the
software creates only one report for that file, but it accumulates coverage from
all the calls to the file. The external MATLAB file coverage report does not include information about what parts of the
model call the external file.MATLAB_file_name
_cov.html
The first section of the external MATLAB file coverage report contains summary information about the external file, similar to the top-level model coverage report.
The Details section reports coverage for the external file and the function in that file.
The Details section also lists the content of the file, and highlights the code lines that have decision points or function definitions.
The coverage results for each of the highlighted code lines follow in the report. This graphic shows a portion of these coverage results from the preceding code example.
Subsystem Coverage Report
If you want to create a model coverage report for individual subsystems, you can create a subsystem coverage report. In the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis, then click Select Subsystem to analyse coverage for the selected subsystem. The software creates a model coverage report for the top-level model, but includes coverage results only for the subsystem.
If the top-level model calls any external files and you select MATLAB files in the Coverage pane in the Configuration Parameters dialog box, the results include coverage for all external files called from:
The subsystem for which you are recording coverage
The top-level model that includes the subsystem
If the subsystem parameter Read/Write Permissions is set to
NoReadOrWrite
, the software does not record coverage for
that subsystem.
For example, in the fuelsys
model, suppose that you click
Select Subsystem and select coverage for the
feedforward_fuel_rate
subsystem.
The report is similar to the model coverage report, except that it includes only
results for the feedforward_fuel_rate
subsystem and its
contents.
Code Coverage Report
For each custom code block, such as S-Function and C Caller blocks, the model coverage report links to a detailed code coverage report for the C/C++ code in the block. For MATLAB Function blocks that call external MATLAB files, the model coverage report links to a detailed code coverage report for each external MATLAB file. For more information on how S-Functions appear in the report, see View Coverage Results for Custom C/C++ Code in S-Function Blocks.
If you have Embedded Coder® installed, you can also generate code coverage reports from models in software-in-the-loop (SIL) or processor-in-the-loop (PIL) mode. For more information on how to generate code coverage reports for models in SIL or PIL mode, see Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode. For more information about the code coverage report, see Code Coverage Report.