Main Content

sltest.testmanager.setpref

Set preferences for Simulink Test Test Manager

Description

settings = sltest.testmanager.setpref("TestFileDisplay",preference,value) sets the Simulink® Test Manager test file section display preference, preference, to value.

example

settings = sltest.testmanager.setpref("TestSuiteDisplay",preference,value) sets the test suite section display preference, preference, to value.

example

settings = sltest.testmanager.setpref("TestCaseDisplay",preference,value) sets the test case section display preference, preference, to value.

example

settings = sltest.testmanager.setpref("MATLABReleases","ReleaseList",releasesForSimulation) adds the releases in releasesForSimulation to the list of available releases in the Simulink Test Manager. This preference lets you use releases other than the current release for testing.

Note

If releasesforSimulation includes a release path that is already in the release preferences, this function returns an error. To include that release in the releasesForSimulation list, first delete the existing release list.

example

settings = sltest.testmanager.setpref("MATLABReleases",releaseName,releaseInfo) adds or deletes the specified releaseName to the list of available releases.

example

simLogSetting = sltest.testmanager.setpref("ShowSimulationLogs","IncludeOnCommandPrompt",value) specifies whether to display simulation logs in the MATLAB® Command Window when you run tests in the Simulink Test Manager.

example

logDetailSetting = sltest.testmanager.setpref("ShowSimulationLogs","ShowAllLogDetails",value) shows detailed error messages and simulation logs in the MATLAB Command Window when value is true.

Note

ShowAllLogDetails is not supported for multiple release tests, real time tests, MATLAB unit tests run in parallel mode, or software-in-the-loop tests run in parallel mode

example

nameSetting = sltest.testmanager.setpref("ResultSetProperty","ResultSetName",name) sets the name to use for test result sets. This name applies to all result sets for tests that you run after you set the preference. This function does not change the names of existing result sets.

example

dashboardSetting = sltest.testmanager.setpref("Dashboard","OpenAtStartup",openTab) opens the dashboard at startup when openTab is true. This setting is only available if you have a Simulink Check™ license.

Examples

collapse all

Change the display setting of a test file section in the Simulink Test Manager.

Get test file display preferences.

settings = sltest.testmanager.getpref("TestFileDisplay")
settings = 

  struct with fields:

           TestTag: 1
       Description: 1
       Requirement: 1
          Callback: 1
          Coverage: 1
    TestFileOption: 1

Hide the Callback section.

settings = sltest.testmanager.setpref...
("TestFileDisplay","Callback",false)
settings = 

  struct with fields:

           TestTag: 1
       Description: 1
       Requirement: 1
          Callback: 0
          Coverage: 1
    TestFileOption: 1

Change the display setting of two test suite sections in the Test Manager.

Get test suite display preferences.

settings = sltest.testmanager.getpref("TestSuiteDisplay")
settings = 

  struct with fields:

        TestTag: 1
    Description: 1
    Requirement: 1
       Callback: 1
       Coverage: 1

Hide the Description and Requirement sections.

settings = sltest.testmanager.setpref...
("TestSuiteDisplay",{'Description','Requirement'},{false,false})
settings = 

  struct with fields:

           TestTag: 1
       Description: 0
       Requirement: 0
          Callback: 1
          Coverage: 1
    TestFileOption: 1

Change the display setting of a test case section in the Test Manager.

Get test case display preferences.

settings = sltest.testmanager.getpref("TestCaseDisplay")
settings = 

  struct with fields:

                      TestTag: 1
                  Description: 1
                  Requirement: 1
            ParameterOverride: 1
                     Callback: 1
                        Input: 1
             SimulationOutput: 1
                    ConfigSet: 1
                FaultSettings: 1
    SequenceDiagramAssessment: 1
                    Iteration: 1
                  Assessments: 1
               CustomCriteria: 1
                     Coverage: 1
             BaselineCriteria: 1
          EquivalenceCriteria: 1

Hide the Fault Settings section.

settings = sltest.testmanager.setpref...
("TestCaseDisplay","FaultSettings",false)
settings = 

  struct with fields:

                      TestTag: 1
                  Description: 1
                  Requirement: 1
            ParameterOverride: 1
                     Callback: 1
                        Input: 1
             SimulationOutput: 1
                    ConfigSet: 1
                FaultSettings: 0
    SequenceDiagramAssessment: 1
                    Iteration: 1
                  Assessments: 1
               CustomCriteria: 1
                     Coverage: 1
             BaselineCriteria: 1
          EquivalenceCriteria: 1

You can add several releases at a time, delete the added releases, or add and delete a single release in your Test Manager MATLAB Release preferences.

Set your preferences to include several releases. Create a structure for each release.

r1 = struct('Name','18b',...
            'MATLABRoot','\\mycompany\R2012b\matlab',...
            'Selected',true);
r2 = struct('Name','19a',...
            'MATLABRoot','\\mycompany\R2014a\matlab',...
            'Selected',true);
r3 = struct('Name','20a',...
            'MATLABRoot','\\mycompany\R2015a\matlab',...
            'Selected',true);

Add the releases using sltest.testmanager.setpref.

sltest.testmanager.setpref('MATLABReleases','ReleaseList',{r1,r2,r3});

Add another release to the preferences.

r4 = struct('Name','19b',...
            'MATLABRoot','\\mycompany\R2013a\matlab',...
            'Selected',true);
sltest.testmanager.setpref('MATLABReleases','19b',{r4});

Delete a release from the preferences.

sltest.testmanager.setpref('MATLABReleases','18b',{[]});

Enable the display of simulation logs in the MATLAB Command Window when you run a test. To see more detailed information, use sltest.testmanager.setpref("ShowSimulationLogs","ShowAllLogDetails",true); instead.

sltest.testmanager.setpref("ShowSimulationLogs",...
   "IncludeOnCommandPrompt",true);

Disable the display of simulation logs output in the Command Window.

sltest.testmanager.setpref("ShowSimulationLogs",...
   "IncludeOnCommandPrompt",false);

View the current simulation logs display setting.

sltest.testmanager.getpref("ShowSimulationLogs",...
   "IncludeOnCommandPrompt")

Specify a nondefault name to use for new result sets.

sltest.testmanager.setpref("ResultSetProperty",...
   "ResultSetName","My Result Set");

Revert to the default result set name by specifying an empty character vector.

sltest.testmanager.setpref("ResultSetProperty",...
   "ResultSetName",'');

Input Arguments

collapse all

Preference name, specified as a string, character vector, or cell array of character vectors. Each preference corresponds to a section in the Simulink Test Manager.

Display OptionPreference
TestFileDisplay
  • TestTag

  • Description

  • Requirement

  • Callback

  • Coverage

  • TestFileOption

TestSuiteDisplay
  • TestTag

  • Description

  • Requirement

  • Callback

  • Coverage

TestCaseDisplay
  • TestTag

  • Description

  • Requirement

  • ParameterOverride

  • Callback

  • Input

  • SimulationOutput

  • ConfigSet

  • FaultSettings

  • SequenceDiagramAssessment

  • Iteration

  • Assessments

  • CustomCriteria

  • Coverage

  • BaselineCriteria

  • EquivalenceCriteria

Example: "TagText"

Example: 'Description'

Example: {'Description','Requirement'}

Preference value, specified as true or false. To display a test section in the Test Manager or display some or all simulation log details in the MATLAB Command Window, set value to true. To hide the section or simulation log details, set value to false.

Example: true

Example: {true,false}

Release to add to or delete from preferences, specified as string or character vector.

Example: '20a'

List of releases to add to Test Manager, specified as a structure or cell array of structures. In the structure, include in this order:

  • 'Name',releaseName

  • 'MATLABRoot',Path

  • 'Selected',logical

Example: struct('Name','20a','MATLABRoot','\\mypath','Selected',true)

Release information, specified as a structure or as {[]}. Use {[]} to delete the release from the preferences. To add a release, in the structure, include:

  • 'Name',releaseName

  • 'MATLABRoot',Path

  • 'Selected',Boolean

Example: struct('Name','20a','MATLABRoot','\\mypath','Selected',true)

Name of the result set, specified as a character vector or string. The new name applies only to new test runs. Setting this property does not change the existing result set names. If you set a new name and then import a result set, the imported result set retains its original name. To revert to the default result set name, specify an empty character vector or string.

Example: 'my Result Set'

Example: "Result Set"

Opens dashboard at startup, specified as true or false (requires Simulink Check).

If you have Simulink Check, you can monitor the progress and quality of your model testing efforts in the Dashboard tab. For information, see View Model Testing Status in Simulink Test Manager (Simulink Check).

Example: true

Output Arguments

collapse all

Preference settings, returned as a structure.

Setting to display simulation logs in the Command Window, returned as 0 (false) or 1 (true).

Setting to display detailed error messages and simulation logs in the Command Window, returned as 0 (false) or 1 (true).

Preference setting for result set name, returned as a character vector.

Dashboard settings, returned as a structure (requires Simulink Check).

Version History

Introduced in R2017a

expand all