[ https://jira.codehaus.org/browse/SUREFIRE-995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=359058#comment-359058 ]
Tibor Digana commented on SUREFIRE-995: --------------------------------------- This already works with JUnit 4.12 (Released on Dec 03, 2014). <groups>categories.SomeCategory</groups> import org.junit.Test; public class SpecialCategorizedTest extends CategorizedTest { @Test public void b() { System.out.println( "SpecialCategorizedTest#b" ); } } import categories.SomeCategory; import org.junit.Test; import org.junit.experimental.categories.Category; @Category( SomeCategory.class ) public class CategorizedTest { @Test public void a() { System.out.println( "CategorizedTest#a" ); } } > Support searching superclass for JUnit @Category > ------------------------------------------------ > > Key: SUREFIRE-995 > URL: https://jira.codehaus.org/browse/SUREFIRE-995 > Project: Maven Surefire > Issue Type: Improvement > Components: Junit 4.x support > Affects Versions: 2.14.1 > Reporter: Paul Philion > Assignee: Tibor Digana > > It looks like when evaluating <groups> and <excludedGroups> using the > @Category, only the test class itself (and not any superclasses) is searched > for the annotation. > It would be very helpful if the search included superclasses. > Aside: It took me a few hours to track this down. I like to implement > abstract superclasses for all my testing patterns (integration test with full > DB vs. "functional test" using stub DB vs strict unit test with mock > objects). Typically, adding the annotation to the superclass (like > @BeforeClass and @AfterClass) to handle standard initialization. However, the > @Category works only in the concrete test class (not an abstract superclass). > If you need a more concrete example (sample code, etc.), I am happy to > provide. > Right now, the simple work-around is to include @Category in all concrete > test classes where it is important. I'm using it in/exclude integration tests. -- This message was sent by Atlassian JIRA (v6.1.6#6162)