Main Content

sltest.testmanager.CoverageSettings Class

Namespace: sltest.testmanager

Modify coverage settings

Description

Instances of sltest.testmanager.CoverageSettings let you set the values in the Coverage Settings section in a test file, test suite, or test case.

The sltest.testmanager.CoverageSettings class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

The getCoverageSettings methods for test file, test suite, and test case objects return an sltest.testmanager.CoverageSettings object, which lets you access the coverage collection and metric settings.

Properties

expand all

Specify if the coverage collection is on or off, false for off and true for on.

Coverage collection is enabled or disabled in the Test Manager Coverage Settings. The corresponding UI option is Record coverage for system under test.

Example: 'Decision',true

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Coverage collection for referenced models is enabled or disabled in the Test Manager Coverage Settings. The corresponding UI option is Record coverage for referenced models.

Example: 'Decision',true

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Selection of coverage settings that are enabled or disabled, specified as a string. For the set of possible strings, see the parameter info for CovMetricSettings in Coverage metric settings (Simulink Coverage) and sltest.plugins.coverage.CoverageMetrics. You can modify coverage metric settings only at the test file level.

Coverage metrics are enabled or disabled in the Test Manager by selecting the check boxes in the Coverage Settings section.

Example: "dw"

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Inactive variants setting for coverage, specified as a logical 0 (false) to include inactive variants in coverage, or 1 (true) to exclude them. An inactive variant is not active at any time while the test runs. This ExcludeInactiveVariants property affects these blocks:

  • Variant blocks in Simulink® with Variant activation time set to startup

  • Variant configurations in Stateflow® charts

You can modify the inactive variants setting only at the test file level. Excluding inactive variant is enabled or disabled in the Test Manager by selecting the check box in the Coverage Settings section. For more information, see Model Coverage for Variant Blocks (Simulink Coverage).

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

The filename of a coverage filter file or files on the MATLAB® path, specified as a string array. The filenames specify the coverage filters that override filter files specified in the model configuration settings. An empty value, "", attaches no coverage filter. For more information on coverage filters, see Coverage Filtering (Simulink Coverage). The coverage filter setting propagates down from test files to test suites and test cases, and its results are displayed at the Result Set level.

Specify the coverage filter filename in the Test Manager, in the Coverage filter filename table of the Coverage Settings section.

Example: "covfilter.cvf"

Example: ["covfilter.cvf";"covfilter2.cvf"]

Example: ""

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Examples

collapse all

% Get coverage settings object from the test file
cov = getCoverageSettings(testfile);
cov.RecordCoverage = true;

% Enable MCDC and signal range coverage metrics
cov.MetricSettings = "mr";

% Specify a coverage filter
cov.CoverageFilterFilename = "covfilter.cvf";

Version History

Introduced in R2016a