sltest.testmanager.setpref

Set Test Manager preferences

Description

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.

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 ManagerMATLAB® Release preferences.

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

r1 = struct('Name','12b',...
            'MATLABRoot','\\mycompany\R2012b\matlab',...
            'Selected',true);
r2 = struct('Name','14a',...
            'MATLABRoot','\\mycompany\R2014a\matlab',...
            'Selected',true);
r3 = struct('Name','15a',...
            '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','13a',...
            'MATLABRoot','\\mycompany\R2013a\matlab',...
            'Selected',true);
sltest.testmanager.setpref('MATLABReleases','13a',{r4});

Delete a release from the preferences.

sltest.testmanager.setpref('MATLABReleases','14a',{[]});

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

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

Example: 'Description'

Example: {'Description','TagText'}

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: '11a'

Release information, specified as a struct or cell array of structs. In the struct, include this information in this order:

  • 'Name',releaseName

  • 'MATLABRoot',Path

  • 'Selected',Boolean

Example: struct('Name','14a','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','14a','MATLABRoot','\\mypath','Selected',true)

Output Arguments

collapse all

Preference settings, returned as a struct.

Introduced in R2017a