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

TestNg provider does not run junit tests correctly when forkMode=always

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.3
    • 2.11
    • TestNG support
    • None

    Description

      We have both TestNG-based tests for unit testing and Junit-based tests (that use Spring OSGi test framework) for integration testing. When running the JUnit tests we would like to use forkMode=always to force the OSGi container to be created for each test. However, when forkMode=always is set, the TestNG provider does not properly run the JUnit test. In the default forkMode of once, the JUnit tests are executed.

      The problem is that the TestNGDirectoryTestSuite.execute method is coded to run both TestNG and JUnit tests when run for multiple test sets (which is executed for forkMode=once), but when run for one test it seems to assume that the test is a TestNG test. I think it should check for JUnit tests in either mode of execution.

      The work-around for the problem is to add the TestNG junit property to the surefire configuration when running the JUnit tests:
      <properties>
      <property>
      <name>junit</name>
      <value>true</value>
      </property>
      </properties>

      Attachments

        Activity

          People

            krosenvold Kristian Rosenvold
            michaelpigg Michael Pigg
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: