Modify coverage settings
sltest.testmanager.CoverageSettings let you set the
values in the Coverage Settings section in a test file, test suite,
or test case.
sltest.testmanager.CoverageSettings class is a
For information on class attributes, see Class Attributes.
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.
RecordCoverage — Enable coverage collection
false (default) |
Specify if the coverage collection is on or off,
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.
MdlRefCoverage — Collect coverage for referenced models
false (default) |
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.
MetricSettings — Coverage metric setting selection
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.
ExcludeInactiveVariants — Inactive variants setting for coverage
0 (default) |
Inactive variants setting for coverage, specified as a logical
false) to include inactive
variants in coverage, or
exclude them. An inactive variant is not active at
any time while the test runs. This
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).
CoverageFilterFilename — Coverage filter to use for coverage analysis
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,
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.
Enable MCDC and Signal Range Coverage Metrics and Specify a Coverage Filter
% 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