Azure Devops-SonarQube CodeCoverage No show results

I’m trying to show the codecoverage result in SonarQube for my projects. I have created pipelines in azure devops, and there is only one warning in task PublishCodeCoverageResults, it says

##[warning]Ignoring coverage report directory with Html content as we are auto-generating Html content

The rest of task are succeded without warnings.

But for any reason I can’t see results
Here are the tasks to do SonarQube analysis

  • script: dotnet test $(Build.SourcesDirectory)/Src/ms_redfox/Application.Tests/Application.Tests.csproj --logger “trx;LogFileName=testresults.trx” /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/
    displayName: ‘dotnet test’

  • script: reportgenerator “-reports:$(Build.SourcesDirectory)/Src/ms_redfox/Application.Tests/TestResults/testresults.trx” “-targetDir:$(Build.SourcesDirectory)/TestResults/Coverage/Reports” -tag:$(Build.BuildNumber) -reportTypes:Cobertura;SonarQube
    workingDirectory: $(Build.SourcesDirectory)/Src/ms_redfox/Application.Tests
    displayName: ‘dotnet reportgenerator’

  • task: PublishTestResults@2
    inputs:
    testRunner: VSTest
    testResultsFiles: ‘**/*.trx’
    failTaskOnFailedTests: true

  • task: PublishCodeCoverageResults@1
    inputs:
    codeCoverageTool: ‘cobertura’
    summaryFileLocation: $(Build.SourcesDirectory)/TestResults/Coverage/**/Cobertura.xml
    reportDirectory: $(Build.SourcesDirectory)/TestResults/Coverage/Reports
    failIfCoverageEmpty: false

  • task: SonarQubePrepare@4
    displayName: ‘Prepare analysis on SonarQube’
    inputs:
    SonarQube: ‘my_sonar_Server’
    scannerMode: ‘MSBuild’
    projectKey: ‘ms_redfox’
    projectName: ‘ms_redfox’
    projectVersion: ‘${{parameters.mainVersion}}’
    extraProperties: |
    sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)//TestResults/Coverage//Cobertura.xml
    enabled: ${{parameters.useSonarQube}}

  • task: CmdLine@2
    displayName: SAM Build
    inputs:
    script: |
    sam build -t cm/ci/template.yaml

Run code analysis

  • task: SonarQubeAnalyze@4
    displayName: ‘Run Code Analysis’
    enabled: ${{parameters.useSonarQube}}

Quality gate

  • task: SonarQubePublish@4
    inputs:
    pollingTimeoutSec: ‘300’
    displayName: ‘Publish Quality Gate Results’
    enabled: ${{parameters.useSonarQube}}

Apologies, I was checking different branch (similar name), so the pieline is working fine. So Im not sure if someone can help me closing this.

Thanks for the follow up!

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.