我正在尝试使用monocov计算单位测试覆盖率并遇到问题,谷歌已经筋疲力尽但似乎没有相关的答案。
我按照[问题]中显示的提示成功下载并构建了monocov:Can't get monocov to compile (Mac OS x 10.7.4)
如http://www.mono-project.com/Code_Coverage
所示,曾尝试将monocov与nunit-console2一起使用这是我的命令:
$ 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
我得到了输出:
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.
$
我得到了一个TestResult.xml是nunit-console2的通用输出文件,并且没有任何错误消息,也没有.ovv文件由于monocov而生成。当前陷入困境并且不知道出了什么问题。
不确定任何关于monocov的专家可以在这里说清楚。谢谢!
答案 0 :(得分:1)
嗯,看来Xamarin已经删除了内部' cov profiler和monocov不会产生任何输出(除了单声道实际加载共享库,没有函数被调用),因为api已经改变。
他们在核心日志分析器中添加了代码覆盖过滤器(2015年4月7日),但我找不到任何已发布的文档(?)。启用它很容易。
--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
关于cov删除和日志覆盖过滤器添加的Git日志信息:
commit 16570265149730ec6a4760cc0fa34decc1a9d981
Author: Alex Rønne Petersen <alexrp@xamarin.com>
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 <iain@xamarin.com>
Date: Fri Feb 27 10:13:54 2015 +0000
[cov] Install a coverage filter