-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JUnit5 tests annotated with @Tag are not executed in suite that has @IncludeTags, unless combined with @SelectPackages #2503
Comments
|
Perhaps I'm misusing this, as you're saying, but it's actually not reducing the tests, it's running all of them, regardless of whether they have the tag. Would you mind showing me what the correct way to do this is? Many thanks in advance! |
If you use |
But this is what I've also tried and it runs all the tests in the packages, regardless of whether they have the |
In the example above, |
Perhaps, SF/FS's way of passing tags and/or applying own filters interferes here? See section "Filtering by Tags" of https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html |
It appears that the integration tests that we had were all named |
Glad you figured it out! For the record that's because of the default class name pattern as documented in the runner's Javadoc: junit5/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java Lines 87 to 93 in 3f7fed6
The default class name pattern is |
Bug description
A test suite with
@IncludeTags({ "foo" })
will not pick up test annotated with@Tag("foo")
, unless the suite also explicitly has the@SelectPackages({ "org.foo" )}
annotation. It should be possible to not have to define all the packages.Steps to reproduce
When you don't have the
@SelectPackages("org.foo")
, theSomeIT
will not be automatically discovered and executed.pom.xml
:This executes the suite with 0 tests in both Idea and a console (using
mvn clean install -Pintegration-tests
).If I restore the commented out
@SelectPackages("org.foo")
, it will run all the tests, regardless of whether they're tagged, or not. It doesn't even care, if they're in those packages. What am I missing here? Is this a bug?Associated Stackoverflow question.
Context
Deliverables
@SelectPackages("org.foo")
, if there is a@IncludeTags
.The text was updated successfully, but these errors were encountered: