Number of unit tests is zero


Analysis of our code base all looks good except the number of unit tests are blank. Screenshot attached. The code and tests are a mixture of kotlin and java.

I have set the following on the gradle command line


  • SQ Version 8.3.1 (build 34397), Jenkins Jenkins 2.231

Is this due to

Many thanks,

Hello @rm25282,

If you have Java code then the Junit report should be read, at least partially (I don’t know how the report looks when the it is on a mix of Java and Kotlin code).
I rather suspect that you have the problem because you’re using wildcards in your property. For historical reasons some report properties support wildcards, some don’t - And the documentation on sonar.junit.reportPaths does not mention wildcard support.

You should have a quite clear log in your scanner execution that would explain why the unit test report is not imported (either wildcard not supported it the files will not be found, or potentially error parsing the junit report if the java plugin does not like that there is some kotlin stuff in there).
Send me the scanner logs (preferable in DEBUG mode) if you want me to take a look.


Hi @OlivierK,
i am using Jest, JUnit with sonarQube… in my SonarQube i am not able to see unit tests, below is my sonar properties and log.
Please suggest me on this.

[Test/Sonar] INFO: Parsing /reports/test-reporter.xml
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] INFO: Total time: 23.444s
[Test/Sonar] INFO: Final Memory: 31M/117M
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] ERROR: Error during SonarQube Scanner execution
[Test/Sonar] ERROR: Error during parsing of generic test execution report ‘/reports/test-reporter.xml’. Look at the SonarQube documentation to know the expected XML format.
[Test/Sonar] ERROR: Caused by: Line 3 of report refers to a file which is not configured as a test file: /src/ test /Users.spec.js
[Test/Sonar] ERROR:
[Test/Sonar] ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[Pipeline] [Test/Sonar] }
[Test/Sonar] WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?




Thanks Olivier for the reply and apologies for taking so long to get back to you.

Indeed I am seeing this in my analysis

Reports path not found or is not a directory: /home/ubuntu/workspace/new_product_develop/exporter//build/test-results//*.xml

I will try again with a hardcoded path.

Does this mean I have to list every directory to scan?

Hello Richard,

The requirement to list all files is not the same for every language and every test tool. Depending on the language and the tool the unit tests and coverage data is produced differently and we had to adjust. So I cannot give you a response if you don’t tell me what language and what coverage tool we’re talking about.
I see in your properties that you try to set sonar.javascript.junit.reportPaths. This property does not exist. We support junit for Java only. For Javascript you have to use the generic test report format we propose as explained in the doc link below.

Please have a look at the details of all the properties at


Hi Olivier,

Sorry but it looks like someone has posted their question in here too. Our env is a mixture of Kotlin and Java code and unit tests. From what you are saying and the documentation will only the Java ones show up in SonarQube? So can you confirm I need to add this

-Dsonar.junit.reportPaths=project_dir1/build/test-results, project_dir2/build/test-results

and keep adding for every directory that has unit tests in it?

Many thanks,

Hello Richard,

Junit tests results anyhow relates to number of tests executed, passed, failed and skipped, without limited notion on the code (or language) they were run on. So you only get to totals numbers, nothing more. They will aggregate the Java and Kotlin tests I would assume (although I never tried this configuration I must say)

About your second question, the path is supposed to be relative to the module root directory (if you have a modular Maven project for instance), so if the files have the same name and path relative to the module home, a simple -Dsonar.junit.reportPaths=build/test-results should be enough.
I would need to know more of your project structure to be sure that this simple configuration would work. Worth a try though…


Hi Richard,

are there any positive results in using a concrete path instead of having wildcards in it?

We have a similar project structure (Android/Kotlin/Gradle) and also have the same problem of missing any test result (nether a test counter nor a test chapter within coverage) even if pass a concrete path for sonar.junit.reportPaths (without wildcards).

Regarding the original topic. Previously surefire reports on Kotlin tests were not supported. In the latest version of Kotlin plugin this feature was added and will be available with the next SonarQube release.


Thanks Margarita.

Is this the plugin you mean?

It hasn’t been updated since 2019

Hello @rm25282,

The web site you’re referring to is not by a SonarSource web site, and I should say, not the trust source by any means for analyzers/plugins developed by us.
Since 8.3 SonarSource analyzers are bundled in SonarQube versions so we don’t communicate on plugin individual versions, but simply on SonarQube version (and the improvements on the bundled analyzers).
For customer still on versions older than 8.3 where plugins can be upgraded separately (provided that they are compatible), they can be found on
Specifically you’ll find the different SonarKotlin plugin versions on and the most recent one is 1.8.1

And Margarita was right, it is bundled in SonarQube 8.6 released in Dec 2020.


Thanks for the prompt response Olivier.

I have upgraded to 8.6 and I still see the unit tests as zero. Is there any specific config I have to update? Or anything I can check to see if they are working or not?


Hi Richard,

Thanks for your response. It’s hard to say where the problem is without a reproducer. Could you please provide us a link to the repository or just a small reproducer, so I can have a look?