Skip to content

Test/feature resource discovery with @SelectClasspathResource("/") no longer works since 7.24.0 #3024

@boast

Description

@boast

👓 What did you see?

Probably the change in #2835 also changed the behaviour of the @SelectClasspathResource annotation.

Previously it was possible to find all cucumber *.feature resource files with the short annotation @SelectClasspathResource("/"). This searched the full classpath for candidates and added them to the test-suite.

This no longer works. The junit-platform-suite will raise an error during test stage, that no test files could be discovered (the error message is TestEngine with ID 'junit-platform-suite' failed to discover tests).

✅ What did you expect to see?

All *.feature resource files will be discovered with @SelectClasspathResource("/") and no error is raised during build from junit-platform-suite.

📦 Which tool/library version are you using?

cucumber-jvm 7.24.0 + 7.25.0 show this behaviour, 7.23.0 (and bellow) does not
all tested with junit(-bom) 5.13.3

🔬 How could we reproduce it?

Not working:

package org.acme.acceptance; // Cucumber Features located in resources/org/acme/acceptance/*.feature

import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("/") // does not work since 7.24.0
class MyAcceptanceTest{
}

Working:

package org.acme.acceptance; // Cucumber Features located in resources/org/acme/acceptance/*.feature

import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;

@Suite
@IncludeEngines("cucumber")
@SelectPackages("org.acme.acceptance") // does work in all versions
class MyAcceptanceTest{
}

📚 Any additional context?

Changing to the mentioned @SelectPackages("path.to.package") and having the resources in said package-path resolves this issue. Seems to me like a regression nevertheless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions