File Exchange

image thumbnail

Coverage Report Generator

version 1.3 (21.8 KB) by

Generates Cobertura-style XML coverage report

4 Downloads

Updated

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
addpath('src');

%import classses, functions
import edu.stanford.covert.test.Coverage;

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

%run code
...

%turn profiler off
profile('off');

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

Comments and Ratings (6)

Han Geerligs

hello,

found the solution: using 'legacy' option in ismember

--Han

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?

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

Jonathan Karr (view profile)

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

James

James (view profile)

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

Updates

1.3

Correct required products list.

1.1

Including missing code

MATLAB Release
MATLAB 7.11 (R2010b)
Acknowledgements

Inspired by: mlcovr Package, absolutepath.m, absolutepath

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Coverage/

Coverage/lib/absolutepath/

Coverage/lib/util/strutil/

Coverage/src/+edu/+stanford/+covert/+test/