Main Content

Verify Requirements and Address Missing Traceability

In this step, you verify requirements by running linked tests using the MATLAB Test Manager. You view the requirements verification status in the Code Quality Dashboard, then use a traceability matrix to identify requirements that are not linked to tests.

Open the MATLABShortestPath project.

openProject("MATLABShortestPath");

Verify Requirements and View Verification Status

Open the Code Quality Dashboard.

codeQualityDashboard

Run all tests in the project by clicking the Run run_16.png button. View the requirements verification status in the Requirements section.

Identify Missing Traceability

The Requirements section indicates that some requirements in the project are not linked to tests. Identify missing traceability for the requirements by creating a traceability matrix with the requirement sets on the top and the tests on the left.

mtxOpts = slreq.getTraceabilityMatrixOptions;
mtxOpts.topArtifacts = ["shortest_path_func_reqs.slreqx",...;
    "shortest_path_tests_reqs.slreqx","shortest_path_demo_reqs.slreqx"];
mtxOpts.leftArtifacts = ["graph_unit_tests","tDemoSmokeTest"];
slreq.generateTraceabilityMatrix(mtxOpts)

In the Filter Panel, in the Top section, filter the matrix to show only the functional requirements not linked to tests by clicking:

  • Top > Link > Missing Links

  • Top > Type > Functional

In the Left section, show only the test functions in the graph_unit_tests file by clicking:

  • Left > Type > Function

  • Left > Attributes > Test

Highlight the rows and columns that do not have links by clicking Highlight Missing Links in the toolstrip.

Address Missing Traceability

The test requirement 2.1.3, Test for a graph that is a tree, is not linked to a test. A tree is a graph in which any two nodes are only connected by one path.

The test case check_invalid_start_1 tests a tree graph by using the graph_straight_seq static method to create the adjacency matrix. Use the graph_straight_seq method to view the tree graph.

A = graph_unit_tests.graph_straight_seq;
G = graph(A);
plot(G,EdgeLabel=G.Edges.Weight)

Create a link from the Test for a graph that is a tree requirement to the check_invalid_start_1 test case by using the traceability matrix you previously generated.

slreq.generateTraceabilityMatrix(mtxOpts)

Click the cell that corresponds to the requirement and the test and select Create. In the Create Link dialog box, click Create.

address-missing-traceability.png

Save the link set that contains the links for shortest_path_tests_reqs.

myLinkSet = slreq.getDependentLinkSets("shortest_path_tests_reqs.slreqx");
save(myLinkSet);

Update the requirements verification status in the Code Quality Dashboard by clicking the three-dot icon three-dot-icon.png in the Requirements section and selecting Run Tests and Refresh Data.

The percentage of passed requirements increases.

See Also

Apps

Related Topics