Run Tests in Multiple Releases of MATLAB

If you have more than one release of MATLAB® installed, you can run tests in multiple releases. Starting with R2011b, you can also run tests in releases that do not have Simulink® Test™.

Although you can run test cases on models in previous releases, the release you run the test in must support the features of the test. For example, if your test involves test harnesses or test sequences, the release must support those features for the test to run.

Before you can create tests that use additional releases, add the releases to your list of available releases using Test Manager preferences. See Add Releases Using Test Manager Preferences.

Considerations for Testing in Multiple Releases

Testing Models in Previous or Later Releases

Your model or test harness must be compatible with the MATLAB version running your test.

  • If you have a model created in a newer version of MATLAB, to test the model in a previous version of MATLAB, export the model to a previous version and simulate the exported model with the previous MATLAB version. For more information, see the information on exporting a model in Save the Model.

  • To test a model in a more recent version of MATLAB, consider using the Upgrade Advisor to upgrade your model for the more recent release. For more information, see Consult the Upgrade Advisor.

Test Case Compatibility with Previous Releases

When performing testing in multiple releases, the MATLAB version must support the features of your test case. For example:

  • Test harnesses are supported in R2015a and later.

  • The Test Sequence block is supported in R2015a and later.

  • verify() statements are supported in R2016b and later.

Test Case Limitations with Multiple Release Testing

Certain features are not supported for multiple-release testing:

  • Parallel test execution

  • Running test cases with the MATLAB Unit Test framework

  • Real-time tests

  • Input data defined in an external Excel® document

  • Coverage collection in the Test Manager

  • Generating additional tests using Simulink Design Verifier™ to increase coverage

  • Including custom figures from test case callbacks

Add Releases Using Test Manager Preferences

Use the Test Manager preferences to include the MATLAB release you want to test in. You can delete a release that you added to the list. You cannot delete the release from which you are running Test Manager.

  1. In the Test Manager, click Preferences.

  2. In the Preferences dialog box, click Release. The Release pane lists the release you are running Test Manager from.

  3. In the Release pane, click Add/Remove releases to open the Release Manager.

  4. In the Release Manager, click Add.

  5. Browse to the location of the MATLAB release you want to add and click OK.

  6. To change the release name that will appear in the Test Manager, edit the Name field.

  7. Close the Release Manager. The Preferences dialog box shows the selected releases. Deselect releases you do not want to make available for running tests.

Run Baseline Tests in Multiple Releases

When you run a baseline test with the Test Manager set up for multiple releases, you can:

  • Create the baseline in the release you want to see the results in, for example, to try different parameters and apply tolerances.

  • Create the baseline in one release and run it in another release. Using this approach you can, for example, know whether a newer release produces the same simulation outputs as an earlier release.

Create the baseline.

  1. Make sure that the release has been added to your Test Manager preferences.

  2. Create a test file, if necessary, and add a baseline test case to it.

  3. Select the test case.

  4. Under System Under Test, enter the name of the model you want to test.

  5. Set up the rest of the test.

  6. Capture the baseline. Under Baseline Criteria, click Capture. Specify the format and file in which to save the baseline and select the release in which to capture the baseline. Then, click Capture to simulate the model.

For more information about capturing baselines, see Capture Baseline Criteria.

After you create the baseline, run the test in the selected releases. Each release you selected generates a set of results.

  1. In the test case, expand Simulation Setting and Release Overrides and, in the Select releases for simulation drop-down menu, select the releases you want to use to compare against your baseline.

  2. Specify the test options.

  3. From the toolstrip, click Run.

    For each release that you select when you run the test case, the pass-fail results appear in the Results and Artifacts pane. For results from a release other than the one you are running Test Manager from, the release number appears in the name.

Test case results hierarchy

Run Equivalence Tests in Multiple Releases

When you run an equivalence test, you compare two simulations. Each simulation runs in a single release, which can be the same or different. Examples of equivalence tests include comparing models run in different model simulation modes, such as normal and software-in-the-Loop (SIL), or comparing different tolerance settings.

  1. Make sure that the releases have been added to your Test Manager preferences.

  2. Create a test file, if necessary, and add an equivalence test case to it.

  3. Select the test case.

  4. Under Simulation 1, System Under Test, enter the name of the model you want to test.

  5. Expand Simulation Setting and Release Overrides and, in the Select releases for simulation drop-down menu, select the release for Simulation 1 of the equivalence test. For an equivalence test, only one release can be selected for each simulation.

  6. Set up the rest of the test.

  7. Repeat steps 4 through 6 for Simulation 2.

  8. In the toolstrip, click Run.

    The test runs each simulation in the release you selected and compares the results for equivalence. For each release that you selected when you ran the test case, the pass-fail results appear in the Results and Artifacts pane. For results from a release other than the one you are running Test Manager from, the release number appears in the name.

    Test case results hierarchy with signal selection check boxes.

Run Simulation Tests in Multiple Releases

Running a simulation test simulates the model in each release you select using the criteria you specify in the test case.

  1. Make sure that the releases have been added to your Test Manager preferences.

  2. Create a test file, if necessary, and add a simulation test case template to it.

  3. Select the test case.

  4. Under System Under Test, enter the model you want to test.

  5. Expand Simulation Setting and Release Overrides and, in the Select releases for simulation drop-down menu, select the release options for the simulation.

  6. Under Simulation Outputs, select the signals to log.

  7. In the toolstrip, click Run.

    The test runs, simulating for each release you selected. For each release, the pass-fail results appear in the Results and Artifacts pane. For results from a release other than the one you are running Test Manager from, the release number appears in the name.

    Test results hierarchy for multiple releases.

See Also

|

Related Topics