5

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?

4

1 に答える 1

4

注: 私は Typemock で働いています

構成を少しいじってみたところ、Isolator で OpenCover をうまく動作させることができました。正式なサポートを追加するまで、それらを連携させるためにできることは次のとおりです。

  1. 実行して OpenCover プロファイラーを登録しますrunsvr32 OpenCover.Profiler.dll(これには管理者のアクセス権が必要です)。
  2. ファイルtypemockconfig.xmlを見つけます。通常、インストール ディレクトリの下にありますC:\Program Files (x86)\Typemock\Isolator\6.0
  3. ファイルを編集し、上記のファイルの末尾に次のエントリを追加します</ProfilerList>
<Profiler Name="OpenCover" Clsid="{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}" DirectLaunch="false">
  <EnvironmentList />
</Profiler>

ファイルを保存すると、Typemock 構成ユーティリティに OpenCover という新しいエントリが作成されます。リンクボタンを押してリンクします。OpenCover.Console.exeこれで、Isolatorを使用してテストを実行できるようになります。たとえば、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

TMockRunner -linkこれを(つまり、レイト リンクで)実行すると、まだマイナーな問題があります。職場でさらに検討する必要があります。

それが役立つことを願っています。

于 2011-07-15T13:18:49.670 に答える