C# Coverlet 结果总是空的
C# Coverlet results always empty
有 .net core 3.1 Microsoft.net.sdk 项目,有很多异步 xUnit 测试。
- 试过 - 添加coverlet.msbuild 2.9.0到项目,然后运行ning:
dotnet test Common\Common.csproj /p:CollectCoverage=true /
显示了 100%,但创建了一个空的覆盖率文件
- 试过 - 添加coverlet.collector 1.3.0到项目然后运行ning:
dotnet test Common\Common.csproj --collect:"XPlat Code Coverage"
在 testresults\{guid}\coverage.cobertura.xml 中创建了一个文件 - 但它只是说 lines-covered=0
而 stdout 表示在 4 秒内进行了 88 次测试 运行。我做错了什么?
对我来说 coverlet.msbuild 与命令完美搭配:
dotnet test Common\Common.csproj /p:CollectCoverage=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile=\"**/Microsoft.NET.Test.Sdk.Program.cs\"
所以,我猜你在这里错过了 CoverletOutputFormat。
有 .net core 3.1 Microsoft.net.sdk 项目,有很多异步 xUnit 测试。
- 试过 - 添加coverlet.msbuild 2.9.0到项目,然后运行ning:
dotnet test Common\Common.csproj /p:CollectCoverage=true /
显示了 100%,但创建了一个空的覆盖率文件 - 试过 - 添加coverlet.collector 1.3.0到项目然后运行ning:
dotnet test Common\Common.csproj --collect:"XPlat Code Coverage"
在 testresults\{guid}\coverage.cobertura.xml 中创建了一个文件 - 但它只是说 lines-covered=0
而 stdout 表示在 4 秒内进行了 88 次测试 运行。我做错了什么?
对我来说 coverlet.msbuild 与命令完美搭配:
dotnet test Common\Common.csproj /p:CollectCoverage=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile=\"**/Microsoft.NET.Test.Sdk.Program.cs\"
所以,我猜你在这里错过了 CoverletOutputFormat。