我想使用今天下载的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/MVC 3应用程序。我的计算机运行Windows 7/32位。关于这个问题,不确定是否有任何相关性,但是即使我将目标平台强制为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
我还尝试了一个DLL项目(.net4),用不同的项目(也是xunit)进行测试,但结果相同(缺乏)。
任何帮助都将不胜感激!