I’m using Jenkins pipeline to run sonarqube for my Java Hybris code. I have added test cases for my pull request but still it showing 0% code coverage. I’m using Sonarqube Developer edition v10.5.1 version. When I scan full Branch then it shows code coverage but for pull request only it showing 0% coverage. I have mentioned sonarqube property below.
sh """${scannerHome}/bin/sonar-scanner \
-Dsonar.projectName=${sonarqube_project_name} \
-Dsonar.scm.disabled=false \
-Dsonar.java.binaries=. \
-Dsonar.sources= <all the SRC Folders>
-Dsonar.projectKey=${sonarqube_project_key} \
-Dsonar.projectVersion=1.1 \
-Dsonar.projectDescription=proj_desc \
-Dsonar.projectBaseDir=projec_base_direct \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.pullrequest.key=pull_req_number \
-Dsonar.pullrequest.branch=${source_branch} \
-Dsonar.pullrequest.base=${target_branch} \
-Dsonar.cpd.exclusions=**/*.java """
Do I need to pass -Dsonar.java.tests
property with all test folders? OR any extra property?
Can anyone help me into this issue ?