Main Content

Find and Run Impacted Tests in Projects Under Source Control

Since R2025a

To monitor for regressions in code functionality when you modify files in projects under source control, you can use the MATLAB Test Manager to find and run tests impacted by changes. Impacted tests are tests that depend on files that have changes after the last commit. For more information about dependency analysis, see Analyze Project Dependencies.

Enable Source Control

You can find impacted tests only when you work with projects under source control. For more information about enabling source control for Git™, Subversion® (SVN), and other tools, see Source Control Integration in MATLAB.

To track changes to your files without sharing the files with others, you can create a local Git repository that is not synced with a remote repository. For more information, see Track Work Locally with Git in MATLAB.

Alternatively, you can find tests that depend on files without enabling source control. For more information, see Find Tests That Depend on Files.

Find and Run Impacted Tests

To find impacted tests, open the MATLAB Test Manager. In the drop-down list in the left of the menu, open the test suite for the impacted tests by clicking Impacted Tests Since Last Commit.

The mouse points to Impacted Tests Since Last Commit in the drop-down list on the left of the MATLAB Test Manager.

To run the tests, click the Run button . You can collect code coverage when you run the tests. For more information, see Collect Code Coverage.

Commit Modified Files

After you examine the test results and qualify the changes, commit the modified files. After you commit the modified files, the Impacted Tests Since Last Commit test suite does not contain tests.

Commit Files by Using Git

To commit the modified files using Git, in the Project tab, in the Source Control section of the toolstrip, click Commit.

The mouse points to the Commit button in the Source Control section of the toolstrip.

In the Commit Changes dialog box, select the files to commit, then click Commit. For more information, see Review and Commit Modified Files to Git.

Commit Files by Using SVN

To commit the modified files using SVN, in the Source Control panel, click Commit. If the Source Control icon is not in the sidebar, click the Open more panels button and select the Source Control panel.

The mouse points to the Commit button in the Source Control panel.

In the Commit Changes dialog box, select the files to commit, and then click Commit. For more information, see Work with Files Under SVN in MATLAB.

See Also

Apps

Topics