If you run test cases in Simulink® Test™ that are linked to requirements in Simulink Requirements™, the aggregated coverage report details the requirements implemented by each model element and the tests that verify those requirements.
To view linked requirements details in your coverage report, you must:
Link to test cases from requirements in Simulink Requirements. For more information, see Link to Test Cases from Requirements (Simulink Requirements) 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.
slreqCCProjectStartProject and Load Test Cases
DriverSwRequest_Tests.mldatx test data suite
and open the Simulink
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.