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

After adding junit-platform-runner dependency, Junit 5 test cases are ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.0.0-M5
    • None
    • Maven Surefire Plugin
    • None

    Description

      I want to run Junit 4 and 5 test cases in same project. Some of the JUnit5 test cases also have @RunWith(JUnitPlatform.class) annotation to run with Junit4.

      To successfully compile class having above annotation, I would need to add "junit-platform-runner" dependency in pom.xml, but the moment I add it, Maven ignores JUnit 5 test cases.

      I have tried various combinations but nothing seems to work. Note that if I remove the class having above annotation and remove "junit-platform-runner" dependency from pom, then Maven is able to run the remaining Junit 4 and 5 test cases successfully. Problem seems to be only with @RunWith(JUnitPlatform.class) annotation and "junit-platform-runner" dependency.

      Note that when I use maven-surefire-plugin version 3.0.0-M4, then everything works fine. Seems to be a bug with 3.0.0-M5. 

      Source code - https://github.com/niajthat/junit45

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              richm123 Rich M
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: