2011-12-21 16 views
0

私は一緒に働くことが困難です。私は、Windowsを使用していNCover 1.5.8 Moles/PexとNUnit

  • NCover 1.5.8(TestDriven.NETに同梱版)
  • NUnitの2.5(TestDriven.NETに同梱版)
  • モグラとPexの

7 x64と.NET 4.0 PexとMolesテストライブラリ

私はthisからのヒント(MSTestでMolesを動作させる方法について)と関連リンクからのヒントに従おうとしました。のおかげで、私はMolesとNUnitを一緒に働かせることができましたが、NCoverと連携させることはできません。

ここにバッチファイルがあります。

:: Some paths 
:: ========== 
set NCoverPath=C:\Program Files (x86)\TestDriven.NET 3\NCover\1.5.8 
set NUnitPath=C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.5 
set MolesPath=C:\Program Files\Microsoft Moles\bin 

:: Some environment variables 
:: ========================== 
:: (I've tried every combination I can think of here...) 
set ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler 
set COMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler 
set COR_PROFILER={3FB1CC1E-1C17-4A37-9C18-BF3DB8F10E46} 
set CLRMONITOR_EXTERNAL_PROFILERS={3FB1CC1E-1C17-4A37-9C18-BF3DB8F10E46} 
:: (Note 3FB1CC1E-1C17-4A37-9C18-BF3DB8F10E46 is the CLSID of NCoverLib.dll 1.5.8. 
:: Use {9721F7EB-5F92-447c-9F75-79278052B7BA} instead for NCover 3.x or later) 

:: Call NCover 
:: =========== 
:: Here is the main call to NCover/Moles.Runner/NUnit-Console 

"%NCoverPath%\ncover.console.exe"^
    //pm moles.runner.exe^
    //ea "moles.runner;mscorlib.Moles"^
    //reg^
    "%MolesPath%\moles.runner.exe" "Pex.Tests.dll"^
     /runner:"%NUnitPath%\NUnit-console.exe" 

そして、これは私が手に出力されます:

NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http://ncover.org 
Copyright (c) 2004-2006 Peter Waldschmidt 

Command: C:\Program Files\Microsoft Moles\bin\moles.runner.exe 
Command Args: ".\Pex.Tests.dll" "/runner:C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.5\NUnit-console.exe" 
Working Directory: 
Assemblies: 
Coverage Xml: Coverage.Xml 
Coverage Log: Coverage.Log 

Waiting for profiled application to connect...Microsoft Moles Runner v0.94.51023.0 -- http://research.microsoft.com/moles -- .NET v4.0.30319 
Copyright (c) Microsoft Corporation 2007-2010. All rights reserved. 

instrumenting...started 
NUnit version 2.5.5.10112 
Copyright (C) 2002-2009 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: Microsoft Windows NT 6.1.7601 Service Pack 1 
    CLR Version: 4.0.30319.239 (Net 4.0) 

ProcessModel: Default DomainUsage: Single 
Execution Runtime: net-4.0 
................................. 
Tests run: 33, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0 seconds 
    Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 

Connected 
Profiled process terminated. Profiler connection not established. 

それはエラーコード1と私のカバレッジファイルは、すべてのテストの名前が含まれているが、ゼロカバレッジを返します。

答えて

1

多くの試行錯誤の末、私はうまくいく組み合わせを見つけました。

  • 必要な設定のみの環境はあなたが
  • nunit-console-x86.exe)、ないCOMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler(他の人のいずれかが上記の設定はNCoverが失敗する原因になります)
  • (代わりにmoles.runner.exeの)使用moles.runner.x86.exeですが、nunit-console.exeを使用
  • のように、複数の/argsパラメータを使用して、nunitに追加の引数を指定することもできます。Microsoft.Moles.NUnit.dllをNUnitのaddinsサブディレクトリにコピーすることを忘れないでください。

修正バッチファイルについては以下を参照してください

:: Some paths 
:: ========== 
set NCoverPath=C:\Program Files (x86)\TestDriven.NET 3\NCover\1.5.8 
set NUnitPath=C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.5 
set MolesPath=C:\Program Files\Microsoft Moles\bin 
set PexPath=C:\Program Files\Microsoft Pex\bin 

:: Important! 
set COMPLUS_ProfAPI_ProfilerCompatibilitySetting=EnableV2Profiler 

:: Here is the main call to NCover/Moles.Runner/NUnit-Console 

"%NCoverPath%\ncover.console.exe"^
    //pm moles.runner.x86.exe^
    //ea "moles.runner;mscorlib.Moles"^
    //reg^
    "%MolesPath%\moles.runner.x86.exe" "Pex.Tests.dll"^
     /runner:"%NUnitPath%\NUnit-console.exe" 

テストを実行、終了コードはゼロであり、カバレッジファイルが生成されます。

あなたはNUnitの出力ファイルを必要としない場合は、次のように実際には、あなたがpex.x86.exeと同じ操作を行うことができます。

"%NCoverPath%\ncover.console.exe" 
    //pm pex.x86.exe 
    //ea "mscorlib.Moles" 
    //reg^
    "%PexPath%\pex.x86.exe" "%TestAssemblyPath%\Pex.Tests.dll" /nor /ftf 

テストを実行、終了コードはゼロであり、カバレッジファイルが生成されます。

関連する問題