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:
Link to test cases from requirements inSimulink Requirements. For more information, seeLink to Test Cases from Requirements(Simulink Requirements)andPerform Functional Testing and Analyze Test Coverage.
Run your test cases through theSimulink TestManager. For more information, seeRequirements-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.
Open theslreqCCProjectStart
Project and Load Test Cases
Open the
slreqCCProjectStart
project.slreqCCProjectStart
Load the
DriverSwRequest_Tests.mldatx
test data suite and open theSimulink TestManager.sltest.testmanager.load('DriverSwRequest_Tests.mldatx') sltest.testmanager.view
In theSimulink TestManager, click the
DriverSwRequest_Tests
test file.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.
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.
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
- 要求测试细节
- Link to Test Cases from Requirements(Simulink Requirements)
- Perform Functional Testing and Analyze Test Coverage