How can I extract code coverage metrics from a code coverage report?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 22 May 2019
Edited: MathWorks Support Team
on 26 Oct 2021
Can I get the summary data extracted from a code coverage report?
I need the data to use it in another report. Is there a way to get just the metrics from the report?
Accepted Answer
MathWorks Support Team
on 22 Oct 2021
Edited: MathWorks Support Team
on 26 Oct 2021
In order to achieve that you need to first create a test object.
>> testObj = cvtest(model);
Then you have to run code coverage on the model.
>> [cvdo,simOut] = cvsim(testObj);
Then you can get the coverage results by using the following functions:
>> blk_handle = get_param([model], 'Handle');
>> executionCoverage = executioninfo(cvdo, blk_handle);
>> conditionCoverage = conditioninfo(cvdo, blk_handle);
>> decisionCoverage = decisioninfo(cvdo, blk_handle);
>> mcdcCoverage = mcdcinfo(cvdo, blk_handle);
You can refer to the attached script which accomplishes the above workflow.
Please follow the documentation link below to automate additional coverage workflows:
0 Comments
More Answers (0)
See Also
Categories
Find more on Collect Coverage for Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!