SonarCloud doesn't show Groovy tests

  • ALM used: Azure DevOps

  • CI system used: Azure DevOps

  • Languages of the repository: Java

  • Error observed: SonarCloud shows neither a proper number of Groovy tests nor Groovy test files.

  • Steps to reproduce
    This is my configuration that perfectly works with SonarQube:

    pomx.xml snippet:
    <properties>
    ...
      <sonar.junit.reportPaths>target/surefire-reports</sonar.junit.reportPaths>
      <sonar.tests>src/test/groovy,src/test/java</sonar.tests>
    ...
    </properties>
    

    The above configuration allows seeing a proper number of tests and groovy files in SonarQube UI.

    I want to achieve the same with SonarCloud. What I have tried:

    1. Added the same configuration to pom.xml

    2. Configured an Azure DevOps pipeline like so:

    - task: SonarCloudPrepare@1
      inputs:
        SonarCloud: 'SonarCloud'
        organization: 'myorg'
        scannerMode: 'Other'
        extraProperties: |
          sonar.junit.reportPaths=target/surefire-reports
          sonar.tests=src/test/groovy,src/test/java
    
    1. Created .sonarcloud.properties file in the root folder of my project:
    sonar.junit.reportPaths=target/surefire-reports
    sonar.tests=src/test/groovy,src/test/java
    

Nothing helped.
SonarCloud still displays a number of tests that corresponds to Java tests ONLY. It completely ignores Groovy tests.

Hey there.

While Groovy files might be supported on SonarQube while using a community-supported plugin (InformSoftware/sonar-groovy), no such support exists on SonarCloud. You can find the list of supported languages on SonarCloud right on the homepage!

Since SonarCloud does not parse Groovy files, it can’t report on them.

Colin

3 Likes

Hi @Colin,

Thank you for your reply!

Did you get me right that I was talking about number of test files?
Can’t SonarCloud just read surefire reports and display a proper number of tests?

Is there any plan to support groovy on SonarCloud?

1 Like

+1, groovy support would be nice to have, if only to help support work around jenkins that uses it extensively for custom libraries and job DSL support.