Opencover 可以与 TypeMock 隔离器一起使用吗?

发布于 2024-11-20 00:07:28 字数 426 浏览 4 评论 0原文

我正在寻找一个 .NET 覆盖工具,并且一直在尝试 PartCover,但取得了不同程度的成功。 我看到 OpenCover 旨在取代 PartCover,但到目前为止我无法将它与 TypeMock Isolator 链接起来,所以我嘲笑-收集覆盖信息时测试通过。

我尝试复制 Partcover 的设置,但没有定义与 Isolator 的“link”参数配合使用的配置文件名称。认为 OpenCover 是基于 Partcover 的,我尝试告诉 Isolator 与 Partcover 链接,它没有抱怨(我仍然安装了 Partcover),但链接不起作用 - Isolator 认为它不存在。

我是不是少了一步?有解决方法吗?或者我必须等待与 OpenCover 友好的 Isolator 版本吗?

I'm looking for a .NET coverage tool, and had been trying out PartCover, with mixed success.
I see that OpenCover is intended to replace PartCover, but I've so far been unable to link it with TypeMock Isolator so my mocked-out tests pass while gathering coverage info.

I tried replicating my setup for Partcover, but there's no defined profilename that works with the "link" argument for Isolator. Thinking that OpenCover was based on Partcover, I tried to tell Isolator to link with Partcover, and it didn't complain (I still had Partcover installed), but the linking didn't work - Isolator thought it wasn't present.

Am I missing a step? Is there a workaround? Or must I wait for an Isolator version that is friends with OpenCover?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东北女汉子 2024-11-27 00:07:28

注意:我在 Typemock 工作

我稍微研究了一下配置,并设法让 OpenCover 与 Isolator 很好地运行。在我们添加官方支持之前,您可以采取以下措施使它们协同工作:

  1. 通过运行 runsvr32 OpenCover.Profiler.dll 注册 OpenCover profiler(您需要管理员访问权限)。
  2. 找到文件 typemockconfig.xml,它应该位于您的安装目录下,通常是 C:\Program Files (x86)\Typemock\Isolator\6.0
  3. 编辑文件,并在文件末尾的 上方添加以下条目:

  <环境列表/>

保存文件,您现在将在 Typemock 配置实用程序中看到一个名为 OpenCover 的新条目。按“链接”按钮将它们链接起来。您现在可以使用 OpenCover.Console.exe 和 Isolator 运行测试。例如,以下是如何使用 MSTest 运行测试:

OpenCover.Console.exe 
-目标:“C:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ Common7 \ IDE \ MSTest.exe”
-targetargs:"/testcontainer:"d:\code\myproject\mytests.dll"   
-输出:opencovertests.xml

使用TMockRunner -link(即后期链接)运行此程序仍然存在一个小问题。我需要在工作中进一步研究它。

希望有帮助。

Note: I work at Typemock

I poked around with the configuration a little bit and managed to get OpenCover to run nicely with Isolator. Here's what you can do to make them work together, until we add official support:

  1. Register OpenCover profiler by running runsvr32 OpenCover.Profiler.dll (you will need an Administrator's access for this).
  2. Locate the file typemockconfig.xml, it should be under your installation directory, typically C:\Program Files (x86)\Typemock\Isolator\6.0.
  3. Edit the file, and add the following entry towards the end of the file, above </ProfilerList>:
<Profiler Name="OpenCover" Clsid="{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}" DirectLaunch="false">
  <EnvironmentList />
</Profiler>

Save the file, you will now have a new entry in the Typemock Configuration utility, called OpenCover. Press the Link button to link them. You will now be able to run your tests using OpenCover.Console.exe and Isolator. For example, here's how to run your tests with MSTest:

OpenCover.Console.exe 
-target:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe"
-targetargs:"/testcontainer:"d:\code\myproject\mytests.dll"   
-output:opencovertests.xml

There is still a minor issue running this with TMockRunner -link (that is, with late linking). I will need to look at it further at work.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文