Main Content

sltest.testmanager.setpref

Set Test Manager preferences

Description

example

settings = sltest.testmanager.setpref(group,preference,value) sets Test Manager preferences in group, specified by preference, and value.

example

settings = sltest.testmanager.setpref('MATLABReleases','ReleaseList',releasePrefs) updates the specified releases in your preferences with the ones specified by releasePrefs. This preference lets you use releases other than the current release for testing.

This syntax replaces the existing list of added releases. Including a release path that is already in the release preferences returns an error. To include that release in the releasePrefs, first delete the existing release list.

example

settings = sltest.testmanager.setpref('MATLABReleases',release,releasePref) adds the specified release to the list of releases in Test Manager preferences. Set releasePref to {[]} to delete that release.

example

simlog_setting = sltest.testmanager.setpref('ShowSimulationLogs','IncludeOnCommandPrompt',value) shows the simulation logs at the MATLAB® command prompt when value is true. The default value is false.

example

name_setting = sltest.testmanager.setpref('ResultSetProperty','ResultSetName',name) sets the name to use for test result sets. The specified 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.

Examples

collapse all

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

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...
('TestFileDisplay',{'Description','Requirement'},{false,false})
settings = 

  struct with fields:

           TestTag: 1
       Description: 0
       Requirement: 0
          Callback: 1
          Coverage: 1
    TestFileOption: 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',{[]});

Turn on displaying the simulation logs at the command prompt.

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

Revert to not displaying simulation logs output at the command prompt.

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

View the current simulation logs display setting.

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

Set 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 group name, specified as one of these values:

  • 'TestFileDisplay' — File section display preferences

  • 'TestSuiteDisplay' — Test suite section display preferences

  • 'TestCaseDisplay' — Test case section display preferences

  • 'MATLABReleases' — MATLAB releases for testing preference

  • 'ShowSimulationLogs' — Whether to show simulation logs at the command prompt

  • 'ResultSetProperty' — Name to use for the result set

Preference name, specified as a character vector. Use settings = sltest.testmanager.getpref(group) to get valid preferences for a particular group.

Example: ('TestSuiteDisplay','TagText')

Example: ('ShowSimulationLogs','IncludeOnCommandPrompt')

Example: ('ResultSetProperty','ResultSetName')

Preference value, specified as a numeric or logical 1 (true) to display the preference or 0 (false) to hide it.

Example: true

Example: {true,false}

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

Example: '20a'

Release information, 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 information from the preferences. 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.

Example: 'my Result Set'

Output Arguments

collapse all

Preference settings, returned as a structure.

Preference setting for whether to display simulation logs at the command line, returned as 0 (false) or 1 (true).

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

Version History

Introduced in R2017a

expand all