opencover + xunit没有结果

Seb*_* F. 9 xunit opencover

我试图使用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:+[*]*
Run Code Online (Sandbox Code Playgroud)

这是我得到的输出

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)
Run Code Online (Sandbox Code Playgroud)

生成的报告始终相同:

<?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>
Run Code Online (Sandbox Code Playgroud)

更多上下文:PDB存在于目标文件夹中,我正在以管理员身份运行命令提示符.测试的项目是.net 4/mvc 3应用程序.我的电脑正在运行Windows 7/32bits.在那个主题上,不确定它是否与任何方式相关,但是x86文件夹中的空是空的,即使我强制目标平台为x86.

此外,当我尝试使用regsvr32注册OpenCover.Profiler.dll时,我收到一条错误消息,指出该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
Run Code Online (Sandbox Code Playgroud)

我还尝试了一个DLL项目(.net4),该项目由不同的项目(也是xunit)测试,结果相同(缺乏).

任何帮助赞赏!

Seb*_* F. 5

下载发行包解决了register参数中的异常问题。但是运行相同的命令行会产生多种此类错误:

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()
Run Code Online (Sandbox Code Playgroud)

结果如下:

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)
Run Code Online (Sandbox Code Playgroud)

在寻找了类似的问题之后,我在github上发现了这个问题,并尝试了-oldStyle参数。它解决了我的问题。

@Shaun Wilde,如果您有机会再次看到此问题,能否告诉我们这是否是解决问题的推荐方法,以及我们是否因违背“正常”方法而失去了使用它的建议(我也建议将此参数添加到文档页面