Junit test reports not imported

I’m using sonarqube Community EditionVersion 9.9 with this version tried to upload junit test reports, my analysis completed successfully but Unit Test results can’t view on the dashboard

Have the below project properties values.

sonar.projectName=AppTest
sonar.scm.disabled=true 
sonar.projectKey=app.test 
sonar.projectVersion=v1.1
sonar.sourceEncoding=UTF-8 
sonar.language=java
sonar.projectBaseDir=/sonar/gradle_build/app1 
sonar.sources=Appsrc
sonar.java.binaries=Appsrc/build/ 
sonar.junit.reportPaths=Appsrc/build/test-results/**/*.xml 
sonar.coverage.jacoco.xmlReportPaths=Appsrc/build/reports/jacoco/*.xml

UT Folder view

$ ls Appsrc/build/test-results/
testfolder testfolder1 testfolder2 testfolder3
testfolder4 testfolder5 testfolder6 testfolder7

I have .xml files inside all the above listed directories. my gradle build and ut & coverage completed before sonarqube analysis.

Can i know what is the issue with my property settings to upload UT reports?

Hey there.

The analyzer is expecting a list of directories, instead of glob patterns. Like:

sonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports

And, if this is a Gradle project, I strongly reccomend using the Scanner for Gradle which should take care of setting these paramters automatically.

Hello Colin,

I’m using sonar-scanner-cli-4.8.0.2856 scanner and tried with below property value.

sonar.junit.reportPaths=Appsrc/build/test-results/testfolder/

Still i can’t see the Unit Tests result on project dashboard.

In log i have below

INFO: parsing [/sonar/gradle_build/app1/Appsrc/build/test-results/testfolder]
ERROR: Reports path not found or is not a directory: /sonar/gradle_build/app1/Appsrc/build/test-results/testfolder

Next with below same problem.

sonar.junit.reportPaths=Appsrc/build/test-results/testfolder/TEST-.*.xml

Error:

INFO: parsing [/sonar/gradle_build/app1/Appsrc/build/test-results/testfolder/Appsrc/build/test-results/testfolder/TEST-.*.xml]
ERROR: Reports path not found or is not a directory: /sonar/gradle_build/app1/Appsrc/build/test-results/testfolder/Appsrc/build/test-results/testfolder/TEST-.*.xml

However my code coverage results able to view on dashboard.

any update on this ?

i have the same problem!

Hi,

I am not sure to have the answer but to see my tests in Sonar UI, I have to add the sonar.tests property to sonar scanner configuration. This is the list of tests folders, like src/test/java,src/it/java.

Maybe it could help.