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

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

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 struct 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');

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

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')

Preference value, specified as true to display the preference or 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 struct or cell array of structs. In the struct, include, in this order:

  • 'Name',releaseName

  • 'MATLABRoot',Path

  • 'Selected',logical

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

Release information, specified as a struct or as {[]}. Use {[]} to delete the release information from the preferences. In the struct, include:

  • 'Name',releaseName

  • 'MATLABRoot',Path

  • 'Selected',Boolean

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

Output Arguments

collapse all

Preference settings, returned as a struct.

Version History

Introduced in R2017a

expand all