We have a mixed testng / junit project (3 and 4) and set up maven to have two guarantees of fidelity; one for junit and one for testng.
I noticed that between surefire 2.15 and 2.16 (and 2.17), our testng provider began to run some of our junit tests. So, I hit my head against the wall, trying to come up with a way to convince the testng runner to not run junit tests at all (since he obviously has problems that do it right). According to the testng documentation, it should respect junit = false or the corresponding testng.junit property. So I tried to convince the right team to pass this configuration, no luck.
Below is my correct configuration with three different attempts to pass this property. The first execution is performed only by junit (548 tests). The second run performs 15 test tests (excellent!), And then another 240 junit tests (not all).
<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>
I suspect the reason is the fix for SUREFIRE-1019 ( https://jira.codehaus.org/browse/SUREFIRE-1019 ) The TestNG provider cannot run the JUnit4 tests that intend to sort because it runs junit, for except that they seem to have forgotten the option to disable behavior.
Is there something I'm missing here?
source
share