JUnit5 Cucumber runner is detected as test class without tests

Make sure to read this post before raising a thread here:

Then tell us:

  • What language is this for? Java
  • Which rule? java:S2187
  • Why do you believe it’s a false-positive/false-negative? False positive
  • Are you using
    • SonarCloud?
    • SonarQube - which version? 8.9.7 (build 52159)
    • SonarLint - which IDE/version?
      • in connected mode with SonarQube or SonarCloud?
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
import static io.cucumber.junit.platform.engine.Constants.*;

import org.junit.platform.suite.api.*;

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("com.project.class.path")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value="com.project.class.path")
public class IntegrationTest {}

Hey there.

This FP might have been fixed by SONARJAVA-3844 (available in SonarQube v9.9 LTS). Can you try the new LTS version to see if the FP persists?

Unfortunately, I’m not in control of my organization’s Sonar maintenance schedule. I’ll try to update the thread when we eventually update. It does appear my organization only updates to LTS versions, so 9.9 might be on the calendar this year

My organization upgraded to Sonar 9.9.1 (build 69595), but the code smell persists :frowning:

Seems like a version of SONARJAVA-2022 for Cucumber with JUnit5 will be necessary

Thank you for the report! I created SONARJAVA-5262 for tracking.