Main Content

Track Changes to Test Cases in Requirements Editor

This example explains how to track changes to Simulink Test test cases in Requirements Editor. You make the changes to test cases associated with a controller model of an automobile cruise control system which is managed in a project. After you make changes to the test cases that are linked to the requirements, you track the changes in the Requirements Editor and clear the change issues by using Traceablility Matrix window.

Open Test File

1. Open the CruiseRequirementsExample project.

openProject("CruiseRequirementsExample");

2. Open Requirements Editor. In the Apps tab, under Verification, Validation, and Test, click Requirements Editor. Open the requirements set file crs_req_func_spec.

3. Open the Test Manager. In the Apps tab, click Simulink Test. In the Test tab, click Simulink Test Manager.

4. In the Test Manager, from the tests folder, open the DriverSwRequest_Tests.mldatx test file.

5. In the Test Browser pane, expand the test case hierarchy. The test file contains the test cases for several of the requirements in the crs_controller model. The Enable Button test case is linked to the requirement Enable Switch Detection (ID 1.6). Similarly, the Increment button hold test case is linked to the requirement Increment Long switch Detection (ID 1.8.2).

Make Changes to Test Cases

When you make changes to test cases linked to the requirements, the Requirements Editor highlights the corresponding link in the Links section. Follow these steps to make changes in the test cases:

1. In the Test Manager, click the test case Enable Button, then exapnd the CUSTOM CRITERIA in the right pane. In the last line of code, change test.verifyTrue(all(compOut)) to test.verifyTrue(any(compOut)).

2. Save the changes.

3. Similarly, click the Increment button hold test case, then expand the SYSTEM UNDER TEST section. Under SIMULATION SETTINGS AND RELEASE OVERRIDES, select and set the value Stop Time to 20.

4. Save the changes.

5. In the Requirements Editor, click requirement 1.6. The Links section shows the changed test objects in red.

The Links section in the right pane. The Increment button hold test case is highlighted.

6. Requirement 1.6 is highlighted because it links to a changed test case. Click requirement 1.6. In the right pane, in the Links section, the change issue icon indicates a change issue.

The Requirements Editor with requirements that indicate change issues.

7. Under Links, select the link and then click on Change Information to view the change issue.

Clear Change Issues for Test Cases

To clear the change issues using the Traceability Matrix window:

1. Open the Traceability Matrix window. In the Requirements Editor, click Traceability Matrix.

2. In the Traceability Matrix window, click Add. In the Select Artifacts dialog, set Left to crs_req_func_spec.slreqx and set Top to DriverSwRequest_Tests.mldatx. Then click Generate Matrix. The window generates a traceability matrix with the specified requirement set on the left and the test case file on the top.

3. To identify unlinked items and changes, click Highlight Missing Links and select Highlight Changed Links and Show Changed Links Only.

4. In the Filter Panel pane, under Cell > Change Tracking, click With Change Issues. The matrix highlights the row, column, and cell that correspond to the link with a change issue.

A traceability matrix with one left and one top artifact. The linked items with change issues are highlighted.

5. To clear the change issue, select the cell that contains the link and click Clear Change Issue. You can export the traceability matrix as an HTML report, a MATLAB variable that contains the table data, or an Excel spreadsheet. For more information, see Export the Traceability Matrix.

See Also

Related Topics