Main Content

View Coverage Results in Simulink Canvas

Overview of Model Coverage Highlighting

When you simulate a Simulink® model, you can configure your model to provide visual results that enable you to see which objects failed to record 100% coverage. After the simulation:

  • In the model window, model objects are highlighted in certain colors according to what coverage was recorded:

    • Green indicates that an object received full coverage during simulation.

    • Green with a dashed border indicates that an object had incomplete coverage that you justified.

    • Red indicates that an object received incomplete coverage.

    • Gray with a dashed border indicates that you excluded an object from coverage.

    • Objects with no color highlighting did not receive coverage.

  • When you place your cursor over a colored object, you see a tooltip with details about the coverage recorded for that block. For subsystems and Stateflow® charts, the coverage tooltip lists the summary coverage for all objects in that subsystem or chart. For other blocks, the coverage tooltip lists specific details about the objects that did not receive 100% coverage.

The simulation highlights blocks that received these types of model coverage:

Enable Coverage Highlighting

Your model will receive coverage highlighting if you simulate the model using the Run button. After simulation, you can see which model objects received full, partial, or no coverage.

If you simulate without the Run button, or load coverage data, you can click Highlight model with coverage results in the Results Explorer to enable model coverage highlighting. To open the results explorer, in the Apps tab, select Coverage Analyzer. Then click Results Explorer. For more information, see Accessing Coverage Data from the Results Explorer. You can also use cvmodelview to enable model highlighting.

Highlighted Coverage Results

Examples of highlighted model objects in colors that correspond to the recorded coverage are:

Green: Full Coverage.  The Switch block received 100% coverage, as indicated by the green highlighting and the information in the coverage tooltip.

The coverage tooltip reads "Full coverage."

Green with Dashed Border: Justified Coverage.  The Relational Operator block received justified coverage, as indicated by the green highlighting with a dashed border and the information in the coverage tooltip.

The coverage tooltip reads "Justified full condition coverage. Full execution coverage. Rationale: 1."

Red: Partial Coverage.  The shift_logic Stateflow chart received this coverage:

The coverage tooltip for the shift logic chart reads as follows: decision coverage 78% (29 out of 37), condition coverage 75% (6 out of 8), MCDC 50% (2 out of 4), Execution coverage 100% (2 out of 2).

Inside the shift_logic Stateflow chart, the gear_state substate was never fourth.

Coverage tooltip reads "Executed substate was never "fourth." Decision 69% (11 out of 16)."

Two of the data ports in the Multiport Switch block were never executed.

The coverage tooltip reads "Control input was never "Case RICH (out = in2)" or "Case *,DISABLED (out = in3).""

Gray with Dashed Border: Filtered Coverage.  The fuel_rate_control subsystem is highlighted in gray because it was excluded from coverage recording.

The coverage tooltip reads "Filtered. Rationale: Exclude from coverage."

No Coloring: Coverage Not Recorded.  The Inport block is not highlighted because it does not receive coverage recording.

Tooltip reads "Inport."

View Coverage Details

After you highlight coverage results on the model, you can view coverage details for each model element in the Coverage Details window. To open the Coverage Details window, click the Coverage Details icon in the lower-left corner of the Simulink block diagram, and then click Open Coverage Details:

You can then click a model object to view its coverage details.