How can I post both Coverage and Tests Executed reports?

My project is dot-net Core running in a unix docker environment. Using XUnit tests.
The Coverage report goes nicely into SonarQube, but the number of Executed Unit Tests is always a dash, or 0 on the dashboard.
Can anyone give me a hint as to what to try next? Below is the script I am running.

Start scanner

RUN dotnet sonarscanner begin

Perform Restore and Build

RUN dotnet restore “PimsAdapterService.sln”
RUN dotnet build --no-restore “PimsAdapterService.sln” -c Release

Run dotnet test setting the output on the /coverage folder

RUN dotnet test PimsAdapterXUnit/PimsAdapterXUnit.csproj --collect:“XPlat Code Coverage” --results-directory ./coverage

Create the code coverage file in sonarqube format using the cobertura file generated from the dotnet test command

RUN reportgenerator “-reports:./coverage/*/coverage.cobertura.xml” “-targetdir:coverage” “-reporttypes:SonarQube”

Run dotnet test again to generate the TestResult.xml file

RUN dotnet test PimsAdapterXUnit/PimsAdapterXUnit.csproj --logger “trx;logfilename=TestResult.xml”

Create the test execute result file to pass to sonarqube

RUN reportgenerator “-reports:/src/PimsAdapterXUnit/TestResults/TestResult.xml” “-targetdir:TestResults” “-reporttypes:SonarQube”

Stop scanner

RUN dotnet sonarscanner end /d:sonar.token=“$SONAR_KEY”


Welcome to the community!

We’ll need to take a look at your debug analysis logs.

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.