This packages uses the profiler to generate a Cobertura-style XML coverage report. We use this report in conjunction with Hudson/Jenkins to track test coverage. The code sample below illustrates how to use the code. See example.m for details.
%add source code to path
%import classses, functions
%turn profiler on
%turn profiler off
%generate coverage report
report = Coverage('src', '..');
report.exportXML(<output file name>);
Jonathan Karr (2021). Coverage Report Generator (https://www.mathworks.com/matlabcentral/fileexchange/33972-coverage-report-generator), MATLAB Central File Exchange. Retrieved .
found the solution: using 'legacy' option in ismember
Very nice Plugin.
I encountered an Issue related to the Matlab profiler. The code after throwing an exception will never be executed. The most errors are thrown in an 'if' statement and at the end is an 'end'. All these 'end's are red in the coverage report because they never will be executed. Is there a possibility to fix them green?
Code does work in recent version of MATLAB (r2012,2014 tested) on Windows. The problem is capitalization of drives in which.m vs absolutepath.m.
The first returns C:\... while the second returns c:\...
This causes a failure on line 190 in Coverage.m
Cannot import as done in the example either, so I have to call the method as
report = edu.stanford.covert.test.Coverage('src', '..');
Sorry for the confusion. I don't believe the Control System Toolbox is required.
Why is Control System Toolbox required?
I'm running R2010b under Ubuntu 12.04 and example.m gives an error on the import line. When I comment out the import and use the full class name to call edu.stanford.covert.test.Coverage, I get a segmentation fault before it even starts running the constructor code. :-(
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!