Sonar overall code coverage percentage is stuck at 30 percent

Hi All,
We are using sonarcloud for our code coverage and yaml pipelines have been written in Azure DevOps . After making significant changes to unit tests in the branch and pushing the commit. But still the code coverage is stuck at 30.6 percent. There is not even fraction of increase in code coverage percentage.
Please guide. How we can achieve this and why there is some issue with data.

- task: SonarCloudPrepare@1
        inputs:
          workingDirectory: '$(System.DefaultWorkingDirectory)/$(REPO_NAME)'
          SonarCloud: 'sonarcloud'
          organization: 'xyz'
          scannerMode: 'MSBuild'
          projectKey: '$(SET_SONAR_DETAILS.SONAR_PROJECT_KEY)'
          projectName: '$(SET_SONAR_DETAILS.SONAR_PROJECT_NAME)'
          projectVersion: '$(TAG_DETAILS.tagName)'
          extraProperties: |
            # Additional properties that will be passed to the scanner, 
            # Put one key=value per line, example:
            sonar.branch.name=$(SOURCE_BRANCH)
            sonar.branch.target=$(TARGET_BRANCH)
            sonar.exclusions=$(DOTNET_SONAR_EXCLUSIONS)
            sonar.coverage.exclusions=$(DOTNET_SONAR_EXCLUSIONS)

1 Like

Hey there.

I would recommend finding a specific example (a file, a line) in SonarCloud where the coverage doesn’t match what you expect. And even more importantly, a discrepancy in the coverage report being produced (the one that is imported to SonarCloud) and what you see in SonarCloud.

At the end of the day, SonarCloud only pays attention to what’s in the coverage report, so it’s important that the source data (the report) is correct.