Main Content

Test Cases per Requirement

Since R2020b

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

You can collect this metric for the Units in your 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 Functional and that are linked to the unit with a link where the Type is set to Implements.

  • 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 getMetrics with the metric ID TestCasesPerRequirement.

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 an integer.

See Also

Related Topics