How to calculate Simulink Test coverage percentage from the command line

7 views (last 30 days)
I am using command line methods for Simulink Test rather than using the test manager (sltestmgr).  In the test manager, it is easy to view the coverage results percentage.  How can I view the percentage from the command line?  If I have a results object, ro [results=run(testManagerFile)], then I can access the coverage results in the following way:
>>ro.CoverageResults
But there doesn't seem to be a property for the coverage percentage

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Oct 2021
Edited: MathWorks Support Team on 26 Oct 2021
ro.CoverageResults returns a cvdata object.  There are methods that you can use with a cvdata object for purposes such as this:
For instance, if you would like to calculate the MCDC coverage, then you can use the 'mdcinfo' method in the following way:
cov = mcdcinfo(ro.CoverageResults, 'model_name')
%Percentage of MCDC outcomes covered
percent_cov = 100 * cov(1) / cov(2)
The 'mcdcinfo' documentation:

More Answers (0)

Categories

Find more on Results, Reporting, and Test File Management in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!