问题描述
在过去的几天里,我已经习惯了OpenCover,并且我注意到使用Moles进行的测试不会生成任何Coverage信息.
I have been getting used to OpenCover over the past few days, and have I noticed that tests using Moles do not generate any Coverage information.
我创建了一个小型解决方案来隔离问题,并且发现仅针对不具有[HostType("Moles")]
属性的测试生成了代码覆盖率.
I have created a small solution to isolate the problem, and have found that code coverage is generated only for tests that do not have the [HostType("Moles")]
attribute.
到处阅读我发现 this 和 此 ,这似乎是我的问题的NCover等效项.他们说这与Moles运行探查器以及coverage工具有关,并且存在一个环境变量CLRMONITOR_EXTERNAL_PROFILERS
,可以将其设置为允许多个探查器与Moles同时运行-我认为这就是解决方案所在,但我不确定100%.我想变量的值应该是OpenCover探查器的名称-有人知道这个名称吗?
Reading around I have found this and this which seem to be NCover equivalents of my problem. They say that it is something to do with Moles running a profiler as well as the coverage tool, and that there is an environment variable CLRMONITOR_EXTERNAL_PROFILERS
that can be set to allow multiple profilers to run at the same time as Moles - I think that this is where the solution lies, but I'm not 100% sure.I guess that the variable's value would be the name of the OpenCover profiler - does anyone know this name?
有没有人设法让Moles运行OpenCover?能做到吗?
Has anyone managed to get OpenCover running with Moles? Can it be done?
推荐答案
您需要的探查器名称可能是CLSID.
The name of the profiler you need is probably the CLSID.
尝试将环境变量设置为1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8
Try setting the environment variable to 1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8
这篇关于没有使用Moles进行测试的代码覆盖率信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!