New lines not covered for Pull request


I am getting “0.00% coverage on new code” ( 284 new lines are there) on sonar cloud for PR analysis. can you please tell me how do enable coverage for pr. We are already passing below variables in my pipeline script:

// Set specific variables for PR (pull request)
    if (typeJob == "multiBranchPR") {
        commonSonarGate["parametersSonarCloud"]["-Dsonar.pullrequest.branch"] = CHANGE_BRANCH
        commonSonarGate["parametersSonarCloud"]["-Dsonar.pullrequest.key"] = CHANGE_ID
        commonSonarGate["parametersSonarCloud"]["-Dsonar.pullrequest.base"] = CHANGE_TARGET

related sonarproperties in file


sonar cloud ui tab: on new code → converage:-


Please do not ping people by name on new posts. I removed them now.

Common problems with missing test coverage:

  • Was the test coverage report file properly imported by the scanner? Please inspect the scanner output, look for lines mentioning “coverage”.
    • If your test report file does not appear anywhere, there are several possibilities
      • Are the report files present in the filesystem at the paths you specified? Please verify.
      • Have you used the correct scanner parameter names to specify the report paths. If there’s a typo, the scanner will not understand your intent.
    • If the scanner output mentions some error about the importing a coverage report, it usually explains an action you need to take to fix the problem. If the action is not clear, you can ask us by providing the message.
  • If the coverage report was correctly imported, but some lines that you think should be covered are in fact not covered, then please check that those files and lines are actually in the report file.

Let me know what you find, and we can proceed from there.

1 Like

Hi @janos
I see below out from my jenkins build.

Hi @janos
I see below warning in jenkins console output:
WARN: Could not find ref: develop in refs/heads, refs/remotes/upstream or refs/remotes/origin