Main Content

MATLAB Test Manager

Manage MATLAB tests and results for projects

Since R2023a

Description

Use the MATLAB Test Manager to manage tests and test results for projects. You can create and run tests and test suites, view results and failure diagnostics, collect coverage, and view coverage reports. View and verify linked requirements.

To add tests to the test manager:

  1. Add a test file to the project. For more information, see Manage Project Files.

  2. Add a Test label to the file. For more information, see Add Labels to Project Files.

  3. Add tests to the test file. For more information, see Ways to Write Unit Tests.

MATLAB Test Manager with 14 passed tests and 1 failed test.

Open the MATLAB Test Manager App

Open a project, then use one of these approaches to open the app:

  • MATLAB® Toolstrip: In the Project tab, in the Tools menu, under Apps, click the MATLAB Test Manager.

  • MATLAB command prompt: Enter matlabTestManager.

Examples

expand all

Open the MATLABShortestPath project.

openProject("MATLABShortestPath");

Open the MATLAB Test Manager.

matlabTestManager

Run all tests in the project by clicking the Run button run_16.png. Filter the results to only show the failed tests by clicking the Failed button in the test results summary.

Open the MATLABShortestPath project.

openProject("MATLABShortestPath");

Open the MATLAB Test Manager.

matlabTestManager

Open the Test Suite Manager by clicking the drop-down to the left of the Run button run_16.png and selecting Manage Custom Test Suites. Click New to create a new test suite. Set the Name field to InputTests.

Select Tags and enter InputTests in the text box. Click Save, then click Close.

In the MATLAB Test Manager, select the test suite by setting the drop-down to the left of the Run button run_16.png to InputTests. Run the tests in the test suite by clicking the Run button run_16.png.

Open the MATLABShortestPath project.

openProject("MATLABShortestPath");

Open the MATLAB Test Manager.

matlabTestManager

Click the Coverage button coverage_16.png, then select Enable Code Coverage and set the metric level to MC/DC.

Run all tests in the project by clicking the Run button run_16.png. The Statement button shows the statement coverage percentage. To view the coverage summary for other coverage metrics, point to the Statement coverage button.

To view the coverage report, click the Statement button, or click the Report button coverage-report_16.png and, under Code Coverage Reports, select the coverage report.

You can customize your test run by using buttons in the toolstrip:

  • Parallel execution — To use parallel execution, click the Parallel button .

  • Strict checks — To treat warnings as errors, enable strict checks. Click the Settings button , then, in the Test Run Settings dialog box, under Strictness, select Apply strict checks when running tests.

  • Output Detail — To specify the detail level for reported events, click the Settings button , then, in the Test Run Settings dialog box, under Output Detail, clear Use Default and set the output detail level.

  • Logging Level — To specify the maximum level at which logged diagnostics are included by the plugin instance, click the Settings button , then, in the Test Run Settings dialog box, under Logging Level, clear Use Default and set the logging level.

  • Display test failure diagnostics in the Command Window — To display test failure diagnostics in the MATLAB Command Window, next to the Run button , click the Expand icon and select Enable logged diagnostics.

Note

The MATLAB Test Manager shares test settings with the MATLAB Editor and Test Browser. For more information, see Comparison of Test Settings.

You can add, remove, and sort columns in the Test Details table.

To add and remove columns, click the Column button and select or clear columns.

Note

To add the Requirements column, you must have Requirements Toolbox™ installed.

To sort the table by a column, point to the column, then click the Sort Up button . To reverse sort, click the Sort Down button .

Version History

Introduced in R2023a

expand all