Maven Surefire
  1. Maven Surefire
  2. SUREFIRE-569

There should be a way to run unit tests from a dependency jar.

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.15
    • Component/s: Maven Surefire Plugin
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      In some cases it would be useful to have a set of tests that run with various dependency configurations. One way to accomplish this would be to have a single project that contains the unit tests and generates a test jar. Several test configuration projects could then consume the unit tests and run them with different dependency sets. The problem is that there is no easy way to run tests in a dependency jar. The surefire plugin should have a configuration to allow me to run all or a set of unit tests contained in a dependency jar.

        Activity

        Hide
        Stephen Colebourne added a comment -

        Thank you very much for applying the patch. And yes, that extra "standardised" filtering would be very nice!

        Show
        Stephen Colebourne added a comment - Thank you very much for applying the patch. And yes, that extra "standardised" filtering would be very nice!
        Hide
        Stephen Colebourne added a comment -

        This worked perfectly for me in the 2.15 release. As the config isn't fully documented I looked at the patch and used that:

        <dependenciesToScan>
          <dependency>com.group.id:my-artifact</dependency>
          <dependency>com.group.id:my-other-artifact</dependency>
        </dependenciesToScan>
        
        Show
        Stephen Colebourne added a comment - This worked perfectly for me in the 2.15 release. As the config isn't fully documented I looked at the patch and used that: <dependenciesToScan> <dependency>com.group.id:my-artifact</dependency> <dependency>com.group.id:my-other-artifact</dependency> </dependenciesToScan>
        Hide
        Andreas Gudian added a comment -

        I've created an issue so that we don't forget implementing that - including updating the docs and examples: SUREFIRE-1004

        Show
        Andreas Gudian added a comment - I've created an issue so that we don't forget implementing that - including updating the docs and examples: SUREFIRE-1004
        Hide
        Torsten Liermann added a comment -

        The extension "dependenciesToScan" is not enough for jars of type test-jar. Please support classifier "tests". Thanks.

        Show
        Torsten Liermann added a comment - The extension "dependenciesToScan" is not enough for jars of type test-jar. Please support classifier "tests". Thanks.
        Hide
        Andreas Gudian added a comment -

        @Torsten: that's supposed to be part of SUREFIRE-1004. Patches are always welcome, if you want to make it more likely that it'll be part of Surefire 2.17

        Show
        Andreas Gudian added a comment - @Torsten: that's supposed to be part of SUREFIRE-1004 . Patches are always welcome, if you want to make it more likely that it'll be part of Surefire 2.17

          People

          • Assignee:
            Kristian Rosenvold
            Reporter:
            Paul Gier
          • Votes:
            19 Vote for this issue
            Watchers:
            20 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: