Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-995

Support searching superclass for JUnit @Category

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.14.1
    • 2.18.1
    • Junit 4.x support
    • None

    Description

      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.

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            philion Paul Philion
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: