Main Content

sltest.testmanager.CoverageSettings class

Package: sltest.testmanager

Modify coverage settings


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 getCoverageSettings methods for test file, test suite, and test case objects returns a sltest.testmanager.CoverageSettings object, which lets you access the coverage collection and metric settings.


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.

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.

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. Coverage metric settings can be modified 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"

The file name of a coverage filter file or files on the MATLAB® path, specified as a string array. The file names 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.cvf1";"covfilter2.cvf"]

Example: ""


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";
Introduced in R2016a