You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "pdolif (via GitHub)" <gi...@apache.org> on 2025/11/25 18:00:43 UTC

[I] TestNG: Inherited tests are not executed when includesFile contains method filters [maven-surefire]

pdolif opened a new issue, #3225:
URL: https://github.com/apache/maven-surefire/issues/3225

   ### Affected version
   
   3.5.4
   
   ### Bug description
   
   Given the following three test classes:
   
   SubClass:
   ```java
   import org.testng.annotations.Test;
   
   public class SubClass extends SuperClass {
       @Test
       public void testInSubClass() {
           System.out.println("TestNG: SubClass#testInSubClass executed");
       }
   }
   ```
   
   SuperClass:
   ```java
   import org.testng.annotations.Test;
   
   public class SuperClass {
       @Test
       public void testInSuperClass() {
           System.out.println("TestNG: SuperClass#testInSuperClass executed");
       }
   }
   ```
   
   OtherClass:
   ```java
   import org.testng.annotations.Test;
   
   public class OtherClass {
       @Test
       public void testIncluded() {
           System.out.println("TestNG: OtherClass#testIncluded executed");
       }
   
       @Test
       public void testNotIncluded() {
           System.out.println("TestNG: OtherClass#testNotIncluded executed");
       }
   }
   ```
   
   When running the tests with `-Dtest=SubClass`, `testInSubClass` and `testInSuperClass` are executed.
   When using an includesFile containing SubClass only, the behavior is the same.
   
   Once the includesFile does not only contain class filters but also method filters, the behavior is different, and `testInSuperClass` is not executed anymore.
   Example includesFile:
   ```
   SubClass
   OtherClass#testIncluded
   ```
   With this, only `testInSubClass`  and `OtherClass#testIncluded` are executed. I would expect `testInSuperClass` to be executed too.
   
   A test reproducing this can be found here: https://github.com/pdolif/maven-surefire/commit/99e5a36fe4ff2633cad603fefa82671cfe89c60b.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] TestNG: Inherited tests are not executed when includesFile contains method filters [maven-surefire]

Posted by "pdolif (via GitHub)" <gi...@apache.org>.
pdolif closed issue #3225: TestNG: Inherited tests are not executed when includesFile contains method filters
URL: https://github.com/apache/maven-surefire/issues/3225


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org