How can I combine multiple single run coverage results into a single, cumulative coverage result?

36 views (last 30 days)
I have run a series of tests on my model file while collecting individual coverage results for each test. I my coverage forlder for my model i now have a large number of .cvt coverage data files that I would like to combine into a single coverage report & data file. How can I combine these results into a single file with all of my coverage data?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Dec 2021
Edited: MathWorks Support Team on 28 Dec 2021
There are two methods that you can use to combine coverage data: the first being done at the command line and the seconds through the coverage Results Explorer UI
To combine coverage data at the command line, you can use the '+' operator to get the union of the cvdata objects:
Alternatively, you can use the coverage Results Explorer to load all of your coverage results for the model from the folder in your screenshot, and combine all of the results into a single cumulative coverage that can be saved:
You can also indicate the need for cumulative coverage collection prior to simulation using the Configuration option under Coverage > Results > Advanced Parameters

More Answers (1)

Kurt Stewart
Kurt Stewart on 2 Jun 2021
Edited: Kurt Stewart on 2 Jun 2021
For running unit tests you can combine different test classes into one suite and run them together
suite = testsuite({'UnitTestClass1.m','UnitTestClass2.m'});
runner = TestRunner.withNoPlugins;
runner.addPlugin(CodeCoveragePlugin.forFolder(pwd, ...
'Producing',CoverageReport('TotalCoverage', ...
web('TotalCoverage/UnitTests.html') %view the results


No tags entered yet.




Community Treasure Hunt

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

Start Hunting!

Translated by