Showing code coverage 0 and tests 0% in sonar-qube

Stevan
Stevan
Member
310 Points
20 Posts

We have circleci as ci/cd and integrated sonar-qube but dashboard is showing code coverage 0 and tests 0%.

.yml file code:

- run:
          name: SonarQube
          command: |
            export PATH="$PATH:/root/.dotnet/tools"
            dotnet tool install --global dotnet-sonarscanner
            dotnet tool install --global dotnet-coverage
            dotnet-sonarscanner begin /k:"mykeyname" /d:sonar.host.url=host_url /d:sonar.login=${SONAR_LOGIN_SECRET} /d:sonar.visualstudio.enable=true /d:sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)\**\*.coveragexml /d:sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)\**\*.trx /d:sonar.verbose=true /d:sonar.log.level="TRACE"
            dotnet build mysolution.sln --no-incremental
            dotnet-coverage collect 'dotnet test' -f xml  -o $(Agent.TempDirectory)\**\*.coveragexml
            dotnet-sonarscanner end /d:sonar.login=${SONAR_LOGIN_SECRET}
Views: 1375
Total Answered: 2
Total Marked As Answer: 0
Posted On: 01-Sep-2022 01:24

Share:   fb twitter linkedin
Answers
edx
edx
Member
506 Points
24 Posts
         

Try following (give solution path name)

- run:
          name: SonarQube
          command: |
            export PATH="$PATH:/root/.dotnet/tools"
            dotnet tool install --global dotnet-sonarscanner
            dotnet tool install --global dotnet-coverage
            dotnet-sonarscanner begin /k:"mykeyname" /d:sonar.host.url=host_url /d:sonar.login=${SONAR_LOGIN_SECRET} /d:sonar.visualstudio.enable=true /d:sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)\**\*.coveragexml /d:sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)\**\*.trx /d:sonar.verbose=true /d:sonar.log.level="TRACE"
            dotnet build mysolution.sln --no-incremental
            dotnet-coverage collect "dotnet test mysolution.sln" -f xml  -o $(Agent.TempDirectory)\**\*.coveragexml
            dotnet-sonarscanner end /d:sonar.login=${SONAR_LOGIN_SECRET}
Posted On: 05-Sep-2022 00:24
kikme
kikme
Member
210 Points
10 Posts
         

Try something:

- run:
    command: |
        dotnet tool install --tool-path . dotnet-sonarscanner
        dotnet tool install --tool-path . dotnet-coverage
        ./dotnet-sonarscanner begin /k:"mykeyname" /d:sonar.host.url=host_url /d:sonar.login=LOGIN_SECRET /d:sonar.cs.vscoveragexml.reportsPaths=*.coverage.xml
        dotnet build mysolution.sln ./dotnet-coverage collect "dotnet test mysolution.sln" -f xml -o "mysolution.coverage.xml"
        ./dotnet-sonarscanner end /d:sonar.login=LOGIN_SECRET
Posted On: 09-Sep-2022 03:51
 Log In to Chat