Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# netcore 3.2中的声纳集成中未显示测试覆盖率_C#_Docker_Sonarqube_.net Core 3.0 - Fatal编程技术网

C# netcore 3.2中的声纳集成中未显示测试覆盖率

C# netcore 3.2中的声纳集成中未显示测试覆盖率,c#,docker,sonarqube,.net-core-3.0,C#,Docker,Sonarqube,.net Core 3.0,我想将声纳集成到我的.netcore 3.2项目中 我做了,但声纳并没有显示测试覆盖范围 我的docker声纳集成如下所示: # install nodejs RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs autoconf libtool nasm ENV SolutionName MyProject # reviewing this cho

我想将声纳集成到我的
.netcore 3.2
项目中

我做了,但声纳并没有显示测试覆盖范围

我的docker声纳集成如下所示:



# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs autoconf libtool nasm

ENV SolutionName  MyProject
# reviewing this choice
ENV SONAR_SCANNER_MSBUILD_VERSION 4.8.0.12008

ARG branchName
RUN wget https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/$SONAR_SCANNER_MSBUILD_VERSION/sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip
RUN apt-get update && apt-get install -yy unzip 
RUN unzip sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip -d /sonar-scanner
# Install Sonar Scanner

RUN rm sonar-scanner-msbuild-$SONAR_SCANNER_MSBUILD_VERSION-netcoreapp3.0.zip
RUN chmod +x -R /sonar-scanner

# Sonar scanner start
RUN dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin /d:sonar.host.url=http://sonar.mycompany.com /d:sonar.login=111111/k:$SolutionName:"$branchName" /n:$SolutionName:"$branchName" /v:1 /d:sonar.cs.opencover.reportsPaths="/app/tests/MyProject.Tests/coverage.opencover.xml"
RUN dotnet test ./tests/CustomerServices.Tests/MyProject.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover 
RUN dotnet publish ./src/MyProject.Api/MyProject.Api.csproj -o /publish
RUN dotnet /sonar-scanner/SonarScanner.MSBuild.dll end /d:sonar.login=111111
# Sonar scanner end
这种集成显示了bug、代码气味和质量门,但没有显示覆盖率

我还在测试项目上安装了coverlet.msbuild,以实现测试覆盖率,但Sonar屏幕上仍然没有测试覆盖率

我的詹金斯长得像这样

Test Run Successful.
Total tests: 684
     Passed: 684
 Total time: 9.9564 Seconds

Calculating coverage result...
  Generating report '/workdir/tests/MyProject.Tests/coverage.opencover.xml'

+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+

+---------+-----------+-----------+-----------+
|         | Line      | Branch    | Method    |
+---------+-----------+-----------+-----------+
| Total   | 100%      | 100%      | 100%      |
+---------+-----------+-----------+-----------+
| Average | Infinity% | Infinity% | Infinity% |
+---------+-----------+-----------+-----------+

如何集成声纳进行测试覆盖