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 you have not linked some requirements in the project to tests. Identify missing traceability for the requirements by generating a traceability matrix. In the Requirements section of the dashboard, click the three-dot icon and select Generate Traceability Matrix.

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)

Figure contains an axes object. The axes object contains an object of type graphplot.

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. 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.

reqSetFile = "shortest_path_tests_reqs.slreqx";
myLinkSet = slreq.getDependentLinkSets(reqSetFile);
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