Main Content

Average Model Coverage for Project

Since R2025a

Metric ID

project.mt.ComponentCoverageBreakdownAverage

Description

You can use this metric to assess the average execution, decision, condition, MC/DC, and integer overflow coverage across the components in the project.

The Project Model Testing dashboard uses the results from this metric in the Coverage section of the dashboard.

Coverage section showing average achieved, justified, and missed model coverage

Supported Artifacts

You can collect this metric for the Units in your project. To control what the dashboard classifies as a unit, see Categorize Models in Hierarchy as Components or Units.

Computation Details

The metric:

  • Calculates the average by using the Model Coverage Breakdown metric results from the components in the project.

  • Does not include coverage from tests that run in software-in-the-loop (SIL) or processor-in-the-loop (PIL) mode.

  • Returns 100% coverage for models that do not have coverage points.

Collection

To collect data for this metric, execute the metric engine and use getMetrics with the metric ID project.mt.ComponentCoverageBreakdownAverage.

metric_engine = metric.Engine;
execute(metric_engine,"project.mt.ComponentCoverageBreakdownAverage");
results = getMetrics(metric_engine,"project.mt.ComponentCoverageBreakdownAverage")

Collecting data for this metric loads the model file and test result files and requires licenses for Simulink® Coverage™ and Simulink Test™.

Results

For this metric, instances of metric.Result return the Value as a struct that contains fields for:

Field NameDescriptionData TypeExample Value
AverageAverage aggregated coverage metrics across components in the projectstruct[1×1 struct]
EmptyResultsNumber of components without metric resultsdouble0
TotalResultsNumber of components with metric resultsdouble5

The Average field contains these fields:

Field NameDescriptionData TypeExample Value
ConditionAverage aggregated execution coverage across the components in the project[1×1 struct]
  struct with fields:

               Achieved: 60.0000
    AchievedOrJustified: 70.0000
              Justified: 10.0000
                 Missed: 30.0000
DecisionAverage aggregated decision coverage across the components in the project
ExecutionAverage aggregated condition coverage across the components in the project
MCDCAverage aggregated modified condition and decision coverage (MC/DC) across the components in the project
OverflowSaturationAggregated saturate on integer overflow coverage for the component

Each of those fields contains a struct with fields:

Field NameDescriptionData TypeExample Value
AchievedAverage percentage of coverage achieved by component testsdouble60.0000
AchievedOrJustifiedAverage percentage of coverage achieved by component tests or justified by coverage filters70.0000
JustifiedAverage percentage of model coverage justified by coverage filters10.0000
MissedAverage percentage of coverage missed by component tests30.0000

Compliance Thresholds

The default compliance thresholds for this metric are:

  • Compliant — Test results have 0% missed coverage

  • Non-Compliant — Test results are missing coverage

  • Warning — None

See Also

| | |

Topics