This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

sltest.testmanager.setpref

Set Test Manager preferences

Syntax

settings = sltest.testmanager.setpref(group,preference,value)
settings = sltest.testmanager.setpref('MATLABReleases','ReleaseList',releasePrefs)
settings = sltest.testmanager.setpref('MATLABReleases',release,releasePref)

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. Set releasePrefs to [] to delete all the added releases.

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, cell array of structs, or as [] to delete all the added release information. In the struct, include, 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 [] 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