Code covered by the BSD License  

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

» Watch video

Highlights from
Coverage Report Generator

4.0
4.0 | 1 rating Rate this file 12 Downloads (last 30 days) File Size: 21.8 KB File ID: #33972 Version: 1.3

Coverage Report Generator

by

Jonathan Karr (view profile)

 

28 Nov 2011 (Updated )

Generates Cobertura-style XML coverage report

| Watch this File

File Information
Description

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>);

Acknowledgements

Mlcovr Package, Absolutepath.M, and Absolutepath inspired this file.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements - MATLAB >= 2008a - includes strjoin function from Peter Acklam (http://home.online.no/~pjacklam/matlab/software/util/) - includes absolutepath function inspired by Jochen Lenz (http://www.mathworks.com/matlabcentral/fileexchange/3857-absolutepath-m)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
08 Mar 2016 Han Geerligs

hello,

found the solution: using 'legacy' option in ismember

--Han

Comment only
21 Oct 2015 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?

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

Comment only
25 Mar 2013 Jonathan Karr

Jonathan Karr (view profile)

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

Comment only
18 Mar 2013 James

James (view profile)

Why is Control System Toolbox required?

Comment only
18 Jul 2012 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. :-(

Comment only
Updates
05 Dec 2011 1.1

Including missing code

25 Mar 2013 1.3

Correct required products list.

Contact us