dotnet 项目的声纳单元测试小部件中未显示测试成功率

Test success rate not showing in sonar unit test widget for dotnet project

我有 运行 声纳 运行ner for msbuild on a c# dot net project。下面运行ning之后是我在unit test widget中得到的结果,

它不显示单元测试成功率。在进一步检查时,我发现每个文件的单元测试也没有显示如下。

在执行此操作时,我遵循了 Unit Test Execution Results Import (C#, VB.NET) 文档页面。我已经对 运行 声纳 运行ner

执行了以下 shell 命令
SET dotnet="C:\Program Files\dotnet\dotnet.exe"
SET opencover=C:\Users\lakshmanu\.nuget\packages\opencover.6.519\tools\OpenCover.Console.exe 
SET targetargs="test -f netcoreapp2.0 -c Release test/Services/UnitTest/UnitTest.csproj"  
SET filter="+[Test.MyTest.*]* -[*.Test]* -[xunit.*]* -[another]*"  
SET coveragefile=Coverage.xml

dotnet restore %WORKSPACE%\Myproj\My.API

MSBuild.SonarQube.Runner.exe begin /k:"test" /n:"test" /v:"1" /s:%WORKSPACE%\SonarQube.Analysis.xml /d:sonar.cs.opencover.reportsPaths="Coverage.xml" /d:sonar.cs.xunit.reportsPaths="D:\sources\test\Services\UnitTest\XUnitResults.xml"

"C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.0\Bin\MSBuild.exe" Myproj.sln /t:Rebuild

REM Run code coverage analysis  
%opencover% -oldStyle -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio17\Community\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" -targetargs:"test\Services\UnitTest\bin\Debug\netcoreapp2.0\UnitTest.dll /Framework:FrameworkCore10" -filter:%filter% -output:%coveragefile% -skipautoprops -hideskipped:All
cd test\Services\UnitTest\
dotnet xunit -xml XUnitResults.xml
cd ..\..\..

MSBuild.SonarQube.Runner.exe end

测试是使用 xunit 框架编写的。 Sonarqube 版本是 5.6.6。 关于为什么未显示每个文件的测试成功率或单元测试的任何线索?

更新

谷歌搜索时我发现 ,根据那个和 sonarqube 文档,目前不支持每个文件的单元测试数量。

SonarQube 根本不跟踪这些指标。

理论上,您的单元测试成功率应该始终为 100%。任何不足都应该使构建失败并抢占分析。