Contenido principal

Requirements-Based Coverage Ratio

R2026b
Since R2026b

Metric ID

modeltesting.RequirementsBasedCoverage[slcomp.CoverageRatio]

Description

This metric returns the percentage of structural coverage achieved by requirements-based tests for each coverage type. The metric reports coverage ratios for execution, decision, condition, and MC/DC coverage.

Use this metric to assess how much structural coverage a unit achieves from tests that are linked to requirements.

Supported Artifacts

This metric collects metric results for Units in the project. To control what the dashboard classifies as a unit, see Categorize Models in Hierarchy as Components or Units.

Collection

To collect data for this metric, execute the metric engine with the metric ID.

metric_engine = metric.Engine;
results = execute(metric_engine,"modeltesting.RequirementsBasedCoverage[slcomp.CoverageRatio]")

View the metric result values for a specific unit.

results(1).Value
results(1).ScopeAlias

To collect all metrics in the modeltesting.RequirementsBasedCoverage group at once, use the group name with empty brackets. Use the MetricID property to distinguish results from different metrics in the group.

results = execute(metric_engine,"modeltesting.RequirementsBasedCoverage[]")

Results

The metric returns an array of metric.Result objects, one for each unit in the project. Use the Value property of the metric result object to view the metric result values. Use the ScopeId and ScopeAlias properties to identify which unit the result belongs to.

The ScopeAlias property returns the name of the unit.

The Value property returns a structure with these fields:

  • Execution — Percentage of execution coverage achieved by requirements-based tests. Empty when no execution coverage data is available.

  • Decision — Percentage of decision coverage achieved by requirements-based tests. Empty when no decision coverage data is available.

  • Condition — Percentage of condition coverage achieved by requirements-based tests. Empty when no condition coverage data is available.

  • MCDC — Percentage of MC/DC coverage achieved by requirements-based tests. Empty when no MC/DC coverage data is available.

See Also

Objects

Functions

Topics