Main Content

getCoverageResults

Class: sltest.testmanager.ResultSet
Namespace: sltest.testmanager

Get coverage results

Syntax

covResult = getCoverageResults(result)
covResult = getCoverageResults(result,model)

Description

covResult = getCoverageResults(result) gets the coverage results that belong to the result set object.

covResult = getCoverageResults(result,model) gets the coverage results that belong to the result set object and the specified model.

Input Arguments

expand all

Result set object to get coverage results from, specified as a sltest.testmanager.ResultSet object.

Name of a model within the set of coverage results, specified as a character vector.

Output Arguments

expand all

Coverage results contained in the result set, returned as an array of cvdata objects. For more information on cvdata objects, see cvdata (Simulink Coverage).

Examples

expand all

Open the model for this example.

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;

Enable MCDC and signal range coverage metrics.

cov.MetricSettings = 'mr';

Run the test case and return an object with results data.

ro = run(tf);

Get the coverage results.

cr = getCoverageResults(ro);

Version History

Introduced in R2016a