Main Content

Trace Coverage Results to Requirements

If you run test cases in金宝app®Test™that are linked to requirements inSimulink Requirements™, the aggregated coverage report details the requirements implemented by each model element and the tests that verify those requirements.

Prerequisites for Tracing Requirements Links

To view linked requirements details in your coverage report, you must:

This example shows how to view the links between test cases, model elements, and linked requirements in a coverage report.

Open theslreqCCProjectStartProject and Load Test Cases

  1. Open theslreqCCProjectStartproject.

    slreqCCProjectStart
  2. Load theDriverSwRequest_Tests.mldatxtest data suite and open theSimulink TestManager.

    sltest.testmanager.load('DriverSwRequest_Tests.mldatx') sltest.testmanager.view
  3. In theSimulink TestManager, click theDriverSwRequest_Teststest file.

  4. To enable decision coverage collection for the test case, in the right pane underCoverage Settings:

    • SelectRecord coverage for system under test.

    • UnderCoverage Metrics, selectDecision.

    • Save your changes.

  5. Run the loaded test cases.

    resultObj = sltest.testmanager.run
  6. When the test finishes, navigate to the test case results in the Test Manager. The Aggregated Coverage Results section displays the coverage for the analyzed model.

  7. ClickReportto create a coverage report.

The coverage report shows requirements details for each model element, including linked requirements, which tests verify the requirements, and which runs are associated with each verification test.

TheDecisions analyzedsection links to the first test case that reached each decision. To see other test cases that also reached a decision, hover over the listed test case. For more information, seeTrace Coverage Results to Associated Test Cases.

Related Topics