Qualify Changes by Comparing Previous Runs Using the MATLAB Test Manager
To prevent introducing regressions to your code base, qualify changes to source or test code by using the MATLAB Test Manager to capture the current state of test and coverage results as a reference. Then, after you develop new changes, re-run the tests, and compare the current results to the reference results.
Capture Reference Results
To capture the current state of test and coverage results as a reference:
Select the test suite that has the tests you want to run by clicking the button to the left of the Run button and selecting
All Tests in Current Project
or a custom test suite. For more information about test suites, see Create and Run Test Suites.Enable coverage and select the desired code coverage metrics to collect. For more information, see Collect Code Coverage.
Customize the test run with your desired settings for strict checks, output detail, and logging level. For more information, see Customize Test Run.
Run the tests by clicking the Run button .
The MATLAB Test Manager stores the five most recent test runs. To save the current test results to an external file, generate a test report. For more information, see Report Test Results.
Develop Changes and Run Tests
After you develop changes or test code in MATLAB® files in the project, re-run the tests.
To avoid overwriting the reference results in the MATLAB Test Manager, first run the tests by using the Test Browser. Iteratively run and change the tests until you are ready to compare the current test results to the reference results. Only then run the test suite in the MATLAB Test Manager. To establish consistency in the test and coverage results to enable comparing runs, run the tests in the same test suite with the same coverage metrics and customizations.
Compare Results to Previous Runs
Compare the current test results to the reference results to determine if the changes introduced new test failures or decreased the coverage percentages. Manually compare the current results to a previous run in the MATLAB Test Manager or in the test report that you saved.
To view a previous run in the MATLAB Test Manager, click the button to the left of the Run button and, under Previous Runs, select the run.
The MATLAB Test Manager opens the test suite, displays the results, and lists the date and time that the suite ran.
If you ran the tests with coverage enabled, you can view a summary of the coverage results for the previous run by pointing to the Statement button. Open the report by clicking the Statement button. Alternatively, click the Report button and, under Code Coverage Reports, select the report.
If you ran equivalence tests that generated C/C++ code as a static library and executed in SIL or PIL mode, you can open the generated code coverage report by clicking the Report button . Then, under Generated Code Coverage Reports, select the report.
To generate a report from the test results in the previous run, click the Report button . Then, under Test Result Reports, click Generate Test Result Report.
To navigate to the current test results, click the button to the left of the Report
button and select
All Tests in Current
Project
or a custom test suite.