2017-05-26 142 views
2

我使用下面的批处理文件,试图生成代码覆盖率结果:C#ASP.NET代码覆盖率 - OpenCover没有结果

@echo off 

SET dotnet="C:/Program Files/dotnet/dotnet.exe" 
SET opencover=.\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe 
SET reportgenerator=.\packages\ReportGenerator.2.5.8\tools\ReportGenerator.exe 

SET targetargs="test .\test\IdentityServer.UnitTests\IdentityServer.UnitTests.csproj -f net461" 
SET filter="+[*]QuickstartIdentityServer* -[*.Tests]* -[xunit.*]* -[FluentValidation]*" 
SET coveragefile=Coverage.xml 
SET coveragedir=Coverage 

REM Run code coverage analysis 
%opencover% -oldStyle -register:user -target:%dotnet% -output:%coveragefile% -targetargs:%targetargs% -filter:%filter% -skipautoprops -hideskipped:All 

REM Generate the report 
%reportgenerator% -targetdir:%coveragedir% -reporttypes:Html;Badges -reports:%coveragefile% -verbosity:Error 

REM Open the report 
start "report" "%coveragedir%\index.htm" 

测试似乎一切正常,但我得到了以下错误信息:

Starting test execution, please wait... 

Total tests: 12. Passed: 12. Failed: 0. Skipped: 0. 

Test Run Successful. 
Test execution time: 4.0469 Seconds 


Committing... 
No results, this could be for a number of reasons. The most common reasons are: 
    1) missing PDBs for the assemblies that match the filter please review the 
    output file and refer to the Usage guide (Usage.rtf) about filters. 
    2) the profiler may not be registered correctly, please refer to the Usage 
    guide and the -register switch. 

的项目做一些更多的背景:

解决方案结构:

test project:SolutionDir\test\IdentityServer.UnitTests\IdentityServer.UnitTests.csproj 

project being tested: 
    path: SolutionDir\src\QuickstartIdentityServer\QuickstartIdentityServer.csproj 
    target framework: net461 

任何帮助表示赞赏!

+0

你产生什么样的PDB文件? –

回答