11

私はOpenCover(今日ダウンロード)を使用してテストの範囲を取得しようとしていました。これが私が使用したコマンドラインです:

OpenCover.Console.exe -target:"c:\Programmes2\xunit\xunit.console.clr4.x86.exe" -targetargs:"""C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll"" /noshadow " -output:bo.coverage.xml -targetdir:"C:\Sources\Project\BackOffice.Tests\bin\Debug" -filter:+[*]*

そして、これが私が得た出力です

xUnit.net console test runner (32-bit .NET 4.0.30319.269)
Copyright (C) 2007-11 Microsoft Corporation.

xunit.dll:     Version 1.9.0.1566
Test assembly: C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll

31 total, 0 failed, 0 skipped, took 2.760 seconds
Committing...
No results - no assemblies that matched the supplied filter were instrumented
    this could be due to missing PDBs for the assemblies that match the filter
    please review the output file and refer to the Usage guide (Usage.rtf)

生成されるレポートは常に同じです。

<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Modules />
</CoverageSession>

もう少しコンテキスト:PDBはターゲットフォルダーに存在します。管理者としてコマンドプロンプトを実行しています。テストされたプロジェクトは、.net 4 /mvc3アプリケーションです。私のコンピューターはWindows7/32ビットを実行しています。そのトピックについては、それが何らかの形で関連しているかどうかはわかりませんが、ターゲットのプレートフォームを強制的にx86にしたとしても、のx86フォルダーは空です。

また、OpenCover.Profiler.dllをzippy32に登録しようとすると、dllが私のWindowsバージョンと互換性がない可能性があるというエラーが表示されます。

-registerまたは-register:userパラメーターを使用しようとすると、例外が発生します。

An exception occured: Failed to register(user:True,register:True,is64:False):3 the profiler assembly; you may want to look into permissions or using the -register:user option instead. C:\Windows\system32\regsvr32.exe /s  /n /i:user "C:\Sources\Opencover\sawilde-opencover-be6e491\main\bin\Debug\x86\OpenCover.Profiler.dll"
stack:    
    à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register, Boolean is64) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 59
    à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 45
    à OpenCover.Framework.ProfilerRegistration.Register(Boolean userRegistration) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 31
    à OpenCover.Console.Program.Main(String[] args) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Console\Program.cs:ligne 82

また、別のプロジェクト(xunitも)でテストされたDLLプロジェクト(.net4)を試してみましたが、同じ(不足している)結果が得られました。

助けていただければ幸いです!

4

1 に答える 1

7

リリース パッケージをダウンロードすると、レジスタ パラメータからの例外が解決されました。しかし、同じコマンド ラインを実行すると、次のような複数のエラーが発生しました。

BackOffice.Tests.HomeControllerShould.Redirect_To_Action_Feed_Index [FAIL]
   System.MissingMethodException : Méthode introuvable : 'Void     System.CannotUnloadAppDomainException.SafeVisited(Int32)'.
   Stack Trace:
      à BackOffice.Tests.HomeControllerShould..ctor()

この結果で:

31 total, 31 failed, 0 skipped, took 0.241 seconds
Committing...
Visited Classes 0 of 44 (0)
Visited Methods 0 of 183 (0)
Visited Points 0 of 1352 (0)
Visited Branches 0 of 322 (0)

==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 0 of 53 (0)
Alternative Visited Methods 0 of 268 (0)

同様の問題を探し回った後、github でこの問題を見つけ、-oldStyle パラメーターを試しました。それは私のものを解決しました。

@Shaun Wilde、万が一この質問をもう一度見た場合は、それがそれを解決するための推奨される方法であるかどうか、そして「通常の」方法に対してそれを使用することで何かを失うかどうか教えていただけますか (このパラメーターをに追加することもお勧めしますドキュメントページ

于 2012-05-30T12:25:27.777 に答える