Tests Per Requirement
Metric ID
TestCasesPerRequirement
Description
Use this metric to count the number of tests linked to each requirement. The metric
analyzes only requirements where the Type is set to
Functional and that are linked to the unit with a link where the
Type is set to Implements. A
test is linked to a requirement 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 the 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, click a metric in the section Tests per Requirement to display the results in a table.
Use
getMetricswith the metric IDTestCasesPerRequirement.
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 structure with fields:
Count— Number of test cases or test iterations linked to a requirement.Status, returned as either:'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 with a link where the Type is set toVerifies.