Main Content

getCoverageSettings

Class: sltest.testmanager.TestFile
Namespace: sltest.testmanager

Get coverage settings

Syntax

covSettings = getCoverageSettings(tf)

Description

covSettings = getCoverageSettings(tf) gets the coverage settings for a test file and returns an sltest.testmanager.CoverageSettings object.

Input Arguments

expand all

Test file object to get coverage settings from, specified as an sltest.testmanager.TestFile object.

Output Arguments

expand all

Coverage settings for the test file, returned as an sltest.testmanager.CoverageSettings object. For information on coverage metrics, see sltest.plugins.coverage.CoverageMetrics.

Examples

expand all

% Open the model for this example
openExample('sldemo_autotrans');

% Create the test file, test suite, and test case structure
tf = sltest.testmanager.TestFile('API Test File');
ts = createTestSuite(tf,'API Test Suite');
tc = createTestCase(ts,'simulation','Coverage Test Case');

% Remove the default test suite
tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);

% Assign the system under test to the test case
setProperty(tc,'Model','sldemo_autotrans');

% Turn on coverage settings at test-file level
cov = getCoverageSettings(tf);
cov.RecordCoverage = true;

Version History

Introduced in R2016a