Main Content

Test Case with Requirement

Since R2020b

Metric ID

TestCaseWithRequirement

Description

Use this metric to determine whether a test is linked to a requirement with a link where the Type is set to Verifies. The metric analyzes only tests that run on the model or subsystems in the unit for which you collect metric data.

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 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, click a metric in the Tests Linked to Requirements section and, in the table, see the Requirement Link Status column.

  • Use getMetrics with the metric ID TestCaseWithRequirement.

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 one of these logical outputs:

  • 0 — The test is not linked to requirements that are implemented in the unit.

  • 1 — The test is linked to at least one requirement with a link where the Type is set to Verifies.

See Also

Related Topics