I uploaded version 0.2 of the monocov coverage tool for Mono here. It is also available from the monocov svn module from the usual Mono svn server.
The release features an improved Gtk# GUI, fixes to html
rendering and other minor improvements.
The usage is pretty simple, just run you program or test suite with the following command after having installed monocov:
mono --debug --profile=monocov program.exeThe coverage information will be output to the program.exe.cov file. Now you can load this file in the GUI with:
monocov program.exe.covand browse the namespaces for interesting types you want to check code coverage for. Double clicking on a method will bring up a viewer with the source file of the method with the lines of code not reached by execution highlighted in red.
To limit the collection of data to a specific assembly you can specify it as an argument to the profiler. For example, to consider only the code in mscorlib, use:
mono --debug --profile=monocov:+[mscorlib] test-suite.exeTo be able to easily collect coverage information from the unit tests in the mono mcs directory you can also run the test suite as follows, for example in mcs/class/corlib:
make run-test RUNTIME_FLAGS="--profile=monocov:outfile=corlib.cov,+[mscorlib]"Monocov can also generate a set of HTML pages that display the coverage data. Here are the files generated when running the nunit-based test suite for mono's mscorlib with the following command:
monocov --export-html=/tmp/corlib-cov corlib.covHopefully this tool will help both new and old contributors to easily find untested spots in our libraries and contribute tests for them.