Skip to content

Do not execute Tests in sibling packages with common prefix#2566

Open
flori-schwa wants to merge 1 commit intoeclipse-jdt:masterfrom
vi-eclipse:fschwabe/issues/2563
Open

Do not execute Tests in sibling packages with common prefix#2566
flori-schwa wants to merge 1 commit intoeclipse-jdt:masterfrom
vi-eclipse:fschwabe/issues/2563

Conversation

@flori-schwa
Copy link

@flori-schwa flori-schwa commented Oct 25, 2025

What it does

Proposed Fix for #2563
Tests from sibling packages are no longer considered for Test Execution when launching JUnit Tests on a Java package.

How to test

Create the following package structure:
grafik
Right Click on the com.example.a package and select "Run As > JUnit Test".
Only the com.example.a.nested.MyNestedTest, com.example.a.MyOtherTest and com.example.a.MyTest Tests are launched. No Tests from the com.example.ab package are launched

Author checklist

When launching JUnit Tests on a package, all Tests contained inside that
package (And nested packages) were launched.
However, Tests contained in sibling packages, that share the same
prefix, were also launched.
com
|
\-- example
   |
   \-- a  <-- Launching JUnit Tests on this package
   |  |
   |  \-- nested
   |  |  |
   |  |  \-- MyNestedTest.java
   |  |
   |  \-- MyTest.java
   |  |
   |  \-- MyOtherTest.java
   |
   \-- ab
      |
      \-- MyTestInSiblingPackage.java <-- Was also executed

Now, only Tests contained in the target package, as well as Tests
contained in real child packages are launched.
Tests contained in sibling packages are no longer considered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant