Main Content

Requirements per Test Case Distribution

Metric ID

RequirementsPerTestCaseDistribution

Description

This metric returns a distribution of the number of requirements linked to each test. Use this metric to determine if tests are linked to a disproportionate number of requirements. The metric analyzes only tests that run on the model or subsystems in the unit for which you collect metric data. A test is linked to a requirement if it has a link where the Type is set to Verifies.

This metric returns the result as a distribution of the results of the Requirements per test metric.

Computation Details

The metric:

  • Analyzes only tests in the project that test:

    • Unit models

    • Atomic subsystems

    • Atomic subsystem references

    • Atomic Stateflow® charts

    • Atomic MATLAB® Function blocks

    • Referenced models

  • Counts only links where the Type is set to Verifies that link to requirements where the Type is set to Functional. This includes links to requirements that are not linked to the unit or are linked to other units. For each test that is linked to requirements, check that the links are to requirements that are implemented by the unit that the test runs on.

Collection

To collect data for this metric:

  • In the Model Testing Dashboard, view the Requirements per Test widget.

  • Use getMetrics with the metric ID RequirementsPerTestCaseDistribution.

Collecting data for this metric loads the model file and requires a Simulink® Test™ license.

Results

For this metric, instances of metric.Result return Value as a distribution structure that contains these fields:

  • BinCounts — The number of tests in each bin, returned as a vector.

  • BinEdges — Bin edges for the number of requirements linked to each test, returned as a vector. BinEdges(1) is the left edge of the first bin, and BinEdges(end) is the right edge of the last bin. The length of BinEdges is one more than the length of BinCounts.

The bins in the result of this metric correspond to the bins 0, 1, 2, 3, and >3 in the Requirements per Test widget.

Compliance Thresholds

This metric does not have predefined thresholds. Consequently, the compliance threshold overlay icon appears when you click Uncategorized in the Overlays section of the toolstrip.

See Also

Related Topics