Bug 63702 - <junit> <batchtest> attribute "skipNonTests" ignores concrete classes that derive from classes with @Test annotated methods
Summary: <junit> <batchtest> attribute "skipNonTests" ignores concrete classes that de...
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.10.6
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-27 13:42 UTC by Tonni
Modified: 2019-08-27 13:43 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tonni 2019-08-27 13:42:35 UTC
Consider the following files:

build.xml:
...
<batchtest todir="somedir" skipNonTests="true">
    <fileset dir="somedir2" includes="**/*.class" />
</batchtest>
...


BaseTest.java:
public abstract Base {
    @Test
    public void doSomeTest();
}


ChildTest.java:
public class Child extends Base {
    @Override
    public void doSomeTest() {
        assertTrue(false);
    }
}


I would expect Ant to run the doSomeTest in Child, as it's base method is annotated with @Test. When having set skipNonTests to "true", no methods in ChildTest are considered as test methods, unless explicitly annotated with @Test too.

When reading the documentation for skipNonTests, I see how this might be implemented as documented, but the behavior is different than you would expect, coming from running tests in IDEs, like Eclipse or IntelliJ IDEA, which do consider Child.doSomeTest to be a test method.