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

cannot disable junit execution with testng provider

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 2.16, 2.17
    • None
    • None
    • java 8, osx, linux

    Description

      We have a project with mixed junit 3,4 and testng tests. To run these, we use two surefire executions, one for testng and one for junit. This works fine in surefire 2.15 but broke in 2.16 and some of our junit tests now execute twice: once by the junit provider and a second time by the testng provider. I suspect this may be related to SUREFIRE-1019, which I guess intended to make it possible to run junit tests with the testng provider, except there appears to be no way to disable the behavior. It only executes some of our junit tests and not all of them so I still need the junit provider anyway.

      I've tried disabling junit execution on the testng by attempting to set junit=false or the corresponding system property testng.junit=false both of which should disable this according to the testng documentation, except it doesn't seem to work. I was not able to make another of their properties (verbose) to produce any output either, so I suspect something is wrong with the way surefire passes properties to testng.

      Here's my plugin configuration with three not working ways of setting that property:

      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.17</version>
      <configuration>
      <includes>
      <include>**/*Test.java</include>
      <include>**/*Test.groovy</include>
      <include>**/*TestSuite.java</include>
      <include>**/*TestSuite.groovy</include>
      </includes>
      </configuration>
      <executions>
      <execution>
      <id>default-test</id>
      <phase>test</phase>
      <goals>
      <goal>test</goal>
      </goals>
      <configuration>
      <testNGArtifactName>none:none</testNGArtifactName>
      <junitArtifactName>junit:junit</junitArtifactName>
      </configuration>
      </execution>
      <execution>
      <id>testngonly</id>
      <phase>test</phase>
      <goals>
      <goal>test</goal>
      </goals>
      <configuration>
      <argLine>-Dtestng.junit=false</argLine>
      <systemPropertyVariables>
      <testng.junit>false</testng.junit>
      </systemPropertyVariables>
      <configuration>
      <properties>
      <property>
      <name>junit</name>
      <value>false</value>
      </property>
      <property>
      <name>verbose</name>
      <value>true</value>
      </property>
      </properties>
      </configuration>
      <junitArtifactName>none:none</junitArtifactName>
      <testNGArtifactName>org.testng:testng</testNGArtifactName>
      </configuration>
      </execution>
      </executions>
      </plugin>

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            jillesvangurp Jilles van Gurp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: