Main Content

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 TypeDescriptionHTML Report File Name
Top-Level Model Coverage ReportProvides coverage information for all the model and its model elements.model_name_cov.html
Model Summary ReportProvides 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_name
active_summary_cov.html
Model Reference Coverage ReportCreated for each referenced model in the model hierarchy. This report has the same format as the top-level model coverage report.reference_model_name
_cov.html
External MATLAB File Coverage ReportProvides detailed coverage information about the MATLAB files that the model calls. There is one report for each external file. MATLAB_file_name
_cov.html
Subsystem Coverage ReportProvides coverage results for the selected subsystem.model_name_cov.html, where model_name is the name of the top-level model
Code Coverage ReportProvides coverage information for C/C++ code in custom code blocks and models in SIL mode.model_name_block_name
_instance_n_cov.html
, or model_name_cov.html

Model Summary Report

If the top-level model contains Model blocks or calls external files, Simulink Coverage creates a model summary coverage report named model_name_active_summary_cov.html. The title of this report is Coverage by Model.

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).

Report title is "Coverage Report by Model." The top model is mExternalMfile. The total coverage report is 90% decision coverage, 75% condition coverage, and 25% MCDC. The report links to 5 separate files that are included in the total coverage.

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 reference_model_name_cov.html, 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.

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 MATLAB_file_name_cov.html, 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.

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 code view of the coverage report highlights lines 2, 6, 12, 21, and 25.

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.

Coverage results for line 2 of the code is for the function externalmfile1, which receives 100% coverage (executed 102 out of 102 times). Coverage results for line 6 of the code is for the expression [if u greater than 1 and u less than 5], which receives 50% decision coverage (decision is false 102 out of 102 times, and true 0 out of 102 times).

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.

See Also

|

Related Topics