Use Simulink Coverage to Analyze Your Model - MATLAB & Simulink (original) (raw)

Main Content

Use Simulink® Coverage™ to gain insight into which parts of your model are exercised during simulation to uncover bugs in your model or gaps in your testing. Your workflow usually looks like:

Flowchart that lists the workflow steps

Enable Coverage and Select Metrics

First, you need to enable coverage and select the coverage metrics that best apply to your model. For more information about selecting metrics, see Enable Coverage and Select Metrics. For detailed information about specific blocks, see Model Objects That Receive Coverage.

Analyze Coverage and View Results

When you simulate your model with coverage enabled, Simulink Coverage reports on, and highlights, the model elements that are exercised during simulation. Use the model coloring in Simulink and the Coverage Details pane to browse the coverage results. You can also use the Coverage Results Explorer to look at individual tests and aggregated coverage and see which tests exercise which model elements. Coverage aggregation, which is also called cumulative coverage, allows you to run multiple tests, each of which might target a specific part of your model, and then combine the coverage from each of your simulations into a single report.

Address Missing Coverage

After you view your model coverage results, you might find that your model does not have 100% coverage. You can increase your model coverage by:

Flowchart that lists options for resolving missing coverage.

Create and Archive Reports

After collecting coverage and addressing unsatisfied outcomes, you can create HTML reports for archiving results. In the Coverage Results Explorer, you can create a report from the aggregated coverage results or from individual test cases.

When you create a standalone coverage report, by default, the coverage tables list the satisfied and unsatisfied outcomes for only the model elements that have incomplete coverage. This is different than the report displayed in theCoverage Details pane, which shows the coverage tables by default. You can change the report settings in the Configuration Parameters window or in the Coverage Results Explorer. See Access, Manage, and Aggregate Coverage Results for more information.

To get started with this tutorial, see

See Also

Topics