File Exchange

image thumbnail

Coverage Report Generator

version (21.8 KB) by Jonathan Karr
Generates Cobertura-style XML coverage report

1 Download

Updated 25 Mar 2013

View Version History

View License

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
import edu.stanford.covert.test.Coverage;

%turn profiler on
profile('on', '-nohistory');

%run code

%turn profiler off

%generate coverage report
report = Coverage('src', '..');
report.exportXML(<output file name>);

Cite As

Jonathan Karr (2021). Coverage Report Generator (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (6)

Han Geerligs


found the solution: using 'legacy' option in ismember


Marcel Scheck

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?

Johan Löfberg

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', '..');

Jonathan Karr

Sorry for the confusion. I don't believe the Control System Toolbox is required.


Why is Control System Toolbox required?

Eric Moyer

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. :-(

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: absolutepath.m, mlcovr Package, absolutepath

Community Treasure Hunt

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

Start Hunting!