gpt4 book ai didi

C# ASP.NET 代码覆盖率 - OpenCover 无结果

转载 作者:太空宇宙 更新时间:2023-11-03 15:04:48 25 4
gpt4 key购买 nike

我正在使用以下批处理文件来尝试生成代码覆盖率结果:

@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

感谢任何帮助!

最佳答案

您可能还需要 set DebugType to full在您的 .csproj 文件中:

<DebugType>full</DebugType>

关于C# ASP.NET 代码覆盖率 - OpenCover 无结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44208381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com