Reputation: 66
I am attempting to use monocov for counting unit testing coverage and encountered a problem, had some exhausted google but seems no relevant answer available.
I download and build the monocov successfully by following this tips showed in this [question]: Can't get monocov to compile (Mac OS x 10.7.4)
Had tried using monocov together with nunit-console2 as indicated at http://www.mono-project.com/Code_Coverage
Here is my command:
$ MONO_OPTIONS="--profile=monocov:+/Users/myaccount/MyProject/MonoForm/MonoForm.Common.Generic/bin/Release" nunit-console2 /Users/myaccount/MyProject/MonoForm/MonoForm.Common.UnitTests/bin/Release/MonoForm.Common.UnitTests.dll
And I got the output as:
NUnit version 2.4.8
Copyright(C) 2002-2007 Charlie Poole.
Copyright(C) 2002-2004 James W. Newkirk, Michael C.Two, Alexei A. Vorontsov.
Copyright(C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 11.4.0.0
CLR Version: 2.0.50727.1433 ( 2.10.9(tarball Mon May 7 20:25:51 EDT 2012) )
......
Tests run: 6, Failures: 0, Not run: 0, Time: 0.052 seconds.
$
I got a TestResult.xml is a general output file of nunit-console2, and there is no any error message nor .cov file generated as a result of monocov. Current stuck and run out of idea what's wrong.
Not sure any expert on monocov could shed some light here. Thanks!
Upvotes: 4
Views: 194
Reputation: 74124
Well, it appears that Xamarin has removed the 'internal' cov profiler and monocov will not produce any output (besides mono actually loading the shared library, no functions are called) as the api has changed.
They have added a code coverage filter (Apr 7 2015) to the core log profilers and while I could not find any published documentation(?). It is easy enough to enable.
--profile=log:coverage
coverage enable collection of code coverage data
covfilter=ASSEMBLY add an assembly to the code coverage filters
add a + to include the assembly or a - to exclude it
filter=-mscorlib
covfilter-file=FILE use FILE to generate the list of assemblies to be filtered
Git log info on cov removal and log coverage filter addition:
commit 16570265149730ec6a4760cc0fa34decc1a9d981
Author: Alex Rønne Petersen <[email protected]>
Date: Tue Apr 7 14:51:27 2015 +0200
[profiler] Remove old mono-cov profiler.
We're replacing this with coverage support in the log profiler.
commit e91693fbb87f687a2fdb5a495c945c1872b3066c
Author: iain holmes <[email protected]>
Date: Fri Feb 27 10:13:54 2015 +0000
[cov] Install a coverage filter
Upvotes: 1