Requirements with Tests Distribution
Metric ID
RequirementWithTestCaseDistribution
Description
Use this metric to count the number of requirements that are linked to tests and the
number of requirements that are missing links to tests. The metric analyzes only
requirements where the Type is set to
Functional and that are linked to a unit with a link where the
Type is set to Implements. A
requirement is linked to a test if it has a link where the Type is
set to Verifies.
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.
Computation Details
The metric:
Analyzes only requirements where the Type is set to
Functionaland that are linked to a unit with a link where the Type is set toImplements.Counts links to tests in the project where the link type is set to
Verifies, including links to tests that test other models or subsystems. For each requirement that is linked to tests, check that the links are to tests that run on the unit that implements the requirement.
Collection
To collect data for this metric:
In the Model Testing Dashboard, place your cursor over the Requirements with Tests widget.
Use
getMetricswith the metric IDRequirementWithTestCaseDistribution.
Collecting data for this metric loads the model file and requires a Requirements Toolbox™ license.
Results
For this metric, instances of metric.Result return
Value as a distribution structure with these fields:
BinCounts— A numeric vector indicating the number of requirements in each bin:BinCounts(1)— Number of requirements not linked to tests.BinCounts(2)— Number of requirements linked to at least one test.
BinEdges— A cell array of descriptive labels for each bin:'Missing linked tests'— The requirement is not linked to tests in the project.'Linked to tests'— The requirement is linked to at least one test where the link Type is set toVerifies.
OverallCount— The total number of functional requirements implemented in the unit with a link where the Type is set toImplements, calculated as the sum of the elements inBinCounts.Ratios— A numeric vector representing the percentage of requirements in each category:Ratios(1)— Percentage of requirements missing links to tests.Ratios(2)— Percentage of requirements with links to tests.
Each ratio is calculated as the
BinCountsdivided by theOverallCount.For example, if 27.27% of unit requirements are missing links and 72.73% have links ,
Ratiosreturns:[0.2727; 0.7273]
Compliance Thresholds
The default compliance thresholds for this metric are:
Compliant— No requirements are missing links to tests.Non-Compliant— One or more requirements are missing links to tests.Warning— None.