Requirements per Test Case Distribution
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
This metric returns the result as a distribution of the results of the
Requirements per test metric.
Analyzes only tests in the project that test:
Atomic subsystem references
Atomic Stateflow® charts
Atomic MATLAB® Function blocks
Counts only links where the Type is set to
Verifiesthat 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.
To collect data for this metric:
In the Model Testing Dashboard, view the Requirements per Test widget.
getMetricswith the metric ID
Collecting data for this metric loads the model file and requires a Simulink® Test™ license.
For this metric, instances of
Value as a distribution structure that contains these fields:
BinCounts— The number of tests in each bin, returned as an integer vector.
BinEdges— Bin edges for the number of requirements linked to each test, returned as an integer 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
BinEdgesis one more than the length of
The bins in the result of this metric correspond to the bins 0, 1, 2, 3, and >3 in the Requirements per Test widget.
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.