主要内容

getCoverageResult

R2026b

Get coverage results (Tech Preview)

Since R2026b

Description

Note

The redesigned Simulink® Test Manager is a tech preview in R2026b. The primary purpose of the tech preview is to provide early access to the most common testing workflows. For more information about supported workflows, see Overview of the Redesigned Simulink Test Manager (Tech Preview).

To enable the feature, click the New Test Manager button in the existing Test Manager or use the sltest.stmv2.open function at the command line.

covResult = getCoverageResult(obj) returns the coverage results associated with the test result object obj. If obj does not contain coverage data, this function returns an empty array.

Examples

collapse all

Get all result sets and iterate over the test case results in the most recent result set.

rs = sltest.stmv2.results.getAllResultSets();
for tfr = rs(end).TestFileResults
    for cut = tfr.CUTResults
        for tcr = cut.TestCaseResults
            cr = getCoverageResult(tcr);
            if ~isempty(cr)
                fprintf("%s: %d/%d decision unsatisfied\n", ...
                    tcr.Name, cr.Summary.Decision.Unsatisfied, ...
                    cr.Summary.Decision.Total);
            end
        end
    end
end

Input Arguments

collapse all

Test results, specified as one of these test result objects:

  • sltest.stmv2.results.TestCaseResult

  • sltest.stmv2.results.CUTResult

  • sltest.stmv2.results.TestFileResult

  • sltest.stmv2.results.ResultSet

Output Arguments

collapse all

Coverage results, returned as an slcoverage.stmv2.CoverageResult object. If the test result does not contain coverage data, returns an empty array.

Version History

Introduced in R2026b