Identify and Address Traceability Gaps
In order to consider the requirements traceability of a requirement set complete, each functional requirement in the set must have an implementation and verification link. In addition to using the implementation and verification status to track progress, you can identify and visualize traceability gaps in your project by using traceability matrices and diagrams.
In this step of the tutorial, you view a traceability diagram for the requirements in the project to visualize their links to designs and tests, use a traceability matrix to view unlinked tests, address the traceability gaps by creating links, and visualize the completed traceability.
Visualize Traceability for Requirements
Open the myAdd2
project, which is similar to the myAdd
project, but contains updated versions of the files that you changed in previous steps.
openProject("myAdd2");
Open the tMyAdd
test file and the myAddTestSpecification
requirement set.
open tMyAdd slreq.open("myAddTestSpecification");
In the Requirements Editor, select the requirement that has the ID Req5
. In the Analysis section, click Traceability Diagram.
The Traceability Diagram window shows that the requirement has both an implementation and a verification link.
Open the myAdd
function and the myAddReqs
requirement set.
open myAdd rs = slreq.open("myAddReqs");
View the traceability diagram for requirement 1.
The Traceability Diagram window shows that the requirement only has an implementation link.
Identify Traceability Gaps
Create a traceability matrix that examines the links between the requirement sets and the tMyAdd
test file:
In the Requirements Editor, click Traceability Matrix.
In the Traceability Matrix window, click Add.
In the Select Artifacts dialog box, click Select Multiple Artifacts.
In the Configure Matrix window, add
myAddReqs.slreqx
andmyAddTestSpecification.slreqx
to the left side of the matrix by right-clicking the file name in the Available Artifacts pane and selecting Add to the left.Add
tMyAdd.m
to the top by right-clicking the file and selecting Add to the top.Remove any additional artifacts from the traceability matrix by right-clicking them and selecting Remove Artifacts.
Generate the matrix by clicking Generate Matrix.
Filter the matrix to only show functional requirements that are missing links by selecting these filters in the Filter Panel:
Left > Type > Functional
Left > Link > Missing Links
Similarly, only show test functions that are missing links by applying these filters:
Top > Type > Function
Top > Link > Missing Links
Highlight the rows and columns that do not have links by clicking Highlight Missing Links in the toolstrip.
Close Traceability Gaps
Close the traceability gaps between the myAddReqs
requirement set and the tMyAdd
test file by creating links between these requirements and the test functions. Hold Ctrl to select the cells that correspond to these rows and columns:
Take two inputs
requirement andtInputs
test functionAdd the inputs
requirement andtAdd
test functionOutput the result
requirement andtOutput
test function
Click Create Link in the toolstrip. In the Create Links dialog box, click Create.
To link the last remaining unlinked requirement, clear the filter Top > Link > Missing Links. Create a link between the Inputs should be finite
requirement and the tFinite
test function.
Save the link set. In the Requirements Editor, click Save > Save All.
Visualize Completed Traceability
Re-open the traceability diagram for requirement 1 in the myAddReqs
requirement set.
req = find(rs,Index=1); slreq.generateTraceabilityDiagram(req)
Refresh the traceability diagram by clicking Analyze.
The Traceability Diagram window shows that the requirement now has both an implementation and verification link.