Main Content

Verify Code by Running Tests

In this step, you verify MATLAB® code by running tests and viewing the test results using the MATLAB Test Manager.

Open the MATLABShortestPath project.

openProject("MATLABShortestPath");

Run Tests and View Results

Open the MATLAB Test Manager.

matlabTestManager

Run all tests in the project by clicking the Run run_16.png button.

The MATLAB Test Manager after running the tests. The window shows that fourteen of the tests passed, and one of the tests failed.

The test tDemoSmokeTest/demoShouldNotWarn fails.

Fixed Failed Test

View the failure diagnostic by clicking the hyperlink in the Diagnostic column.

The diagnostics from the test failure in the MATLAB Test Manager. It shows additional information about the cause of the test failure, including links to the sources of the failure and how they propagate.

Navigate to the source code that errored by clicking the first hyperlink in the failure diagnostic.

The source of the error after clicking the hyperlink. It shows a live script and a line of code that has an error. The message indicates that the statement is incomplete.

The statement on line 11 is incomplete. Complete the statement by adding a parenthesis, then re-run the test.

The MATLAB Test Manager after running the tests and fixing the source of the failure. The window shows that fifteen of the tests passed.

All tests pass.

See Also

Apps

Related Topics