Trace Coverage Results to Requirements
If you run test cases in Simulink® Test™ that are linked to requirements in Requirements Toolbox™, 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:
Link to test cases from requirements in Requirements Toolbox. For more information, see Link Test Cases to Requirements (Requirements Toolbox) and Perform Functional Testing and Analyze Test Coverage.
Run your test cases through the Simulink Test Manager. For more information, see Requirements-Based Testing for Model Development (Simulink Test).
Record the aggregated coverage results for at least two test cases.
This example shows how to view the links between test cases, model elements, and linked requirements in a coverage report.
slreqCCProjectStart Project and Load Test Cases
DriverSwRequest_Tests.mldatxtest data suite and open the Simulink Test Manager.
In the Simulink Test Manager, click the
To enable decision coverage collection for the test case, in the right pane under Coverage Settings:
Select Record coverage for system under test.
Under Coverage Metrics, select Decision.
Save your changes.
Run the loaded test cases.
resultObj = sltest.testmanager.run
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.
Click Report to 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.
The Decisions analyzed section 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, see Trace Coverage Results to Associated Test Cases.