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

Surefire doesn't pick up tests from junit5

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      What is happening

      Given I am using junit5 with a failing test:

      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.1.0-M1</version>
      

      When I `mvn package`
      Then I see 

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
      

      And the jar is successfully created

       

       

      What should happen
      Given I am using junit5 with a failing test
      When I use `mvn package`
      Then I see

      Tests run: 0, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
      

      And the jar is not successfully created.

      NB:
      This issue can be resolved / worked around in older versions of Apache Maven and two additional plugins like so:

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <dependencies>
          <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-surefire-provider</artifactId>
            <version>1.0.3</version>
          </dependency>
          <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.0.3</version>
          </dependency>
        </dependencies>
      </plugin>
      

      But using these plugins will not work with the latest plugin, and tests are not picked up.

       

      Attachments

        1. surefire-plugin-bug.zip
          20 kB
          Kathryn Newbould

        Issue Links

          Activity

            People

              sor Christian Stein
              KathrynNewbould Kathryn Newbould
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: