Skip to content

TestNG: Inherited tests are not executed when includesFile contains method filters #3225

@pdolif

Description

@pdolif

Affected version

3.5.4

Bug description

Given the following three test classes:

SubClass:

import org.testng.annotations.Test;

public class SubClass extends SuperClass {
    @Test
    public void testInSubClass() {
        System.out.println("TestNG: SubClass#testInSubClass executed");
    }
}

SuperClass:

import org.testng.annotations.Test;

public class SuperClass {
    @Test
    public void testInSuperClass() {
        System.out.println("TestNG: SuperClass#testInSuperClass executed");
    }
}

OtherClass:

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: pdolif@99e5a36.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions