To address the DASH in the "Unit Test" in the sonar report

Must-share information (formatted with Markdown):
SonarQube version :
Need to address the “-” in the unit test case field - in the sonar report
Checked the sonar. Properties file everything seems to be okay. please assist on this issue.

You will need to pass Test Execution Reports to get the count of unit tests.

Hi Colin ,

Thanks for checking, Text execution reports are already added, please find the below file.

sonar.projectName=Pearson DMS POD Module




It looks like you’re analyzing Java code. I would suggest using the Scanner for Maven, Scanner for Gradle, or Scanner for Ant depending on how your project is built. In this case, everything should be configured for you (rather than setting the parameters yourself).

Otherwise, you’ll have to dive into the scanner logs to find out what happens when the scanner tries to read your test execution reports.

Hi Colin,

Where we can find the Scanner logs, could you please assist with the steps to get the scanner logs.

The scanner logs are the output of running the sonar-scanner command or one of the mentioned scanners that integrate with your build tool, wherever that is running (locally, in a CI, etc.)

logJenkings.txt (3.8 MB)
Hi Colin,

Could you please check the attached log file and let us know why unit test case is showing as Dash in sonar.

It looks like you’re running the sonar-scanner manually when you could just run mvn sonar:sonar (you’re already running maven to build your code) – which would also become aware of the tests you run. The documentation on the SonarScanner for Jenkins describes how to do this.

Do you know why you use the sonar-scanner today instead of the SonarScanner for Maven?

Right now, the scanner doesn’t like the path you’ve passed to sonar.junit.reportPaths

09:03:33.025 INFO: Sensor SurefireSensor [java]
09:03:33.026 INFO: parsing [/home/jenkins/workspace/alfresco/edms-nonprod/buildJobs/pearson-dms-common-build-job/dms-pod-repo/target/surefire-reports/TEST-*.xml]
09:03:33.027 ERROR: Reports path not found or is not a directory: /home/jenkins/workspace/alfresco/edms-nonprod/buildJobs/pearson-dms-common-build-job/dms-pod-repo/target/surefire-reports/TEST-*.xml
09:03:33.027 INFO: Sensor SurefireSensor [java] (done) | time=2ms

You could try this:


And it would probably work. But I would really suggest you use the purpose-built scanner for Maven.

Hi Colin,

Issue got fixed after changing the path, thanks for your help.