What is the difference between SureFire JUnitCore and JUnit4 Runners

2.2k views Asked by At

Maven surefire has

What is the difference between them?

I notice, that property excludedGroups work in surefire-junit47, but doesn't work in surefire-junit4 Why?

  <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.surefire</groupId>
                    <artifactId>surefire-junit4</artifactId>
                    <version>2.18</version>
                </dependency>
            </dependencies>
            <configuration>
               <excludedGroups>my.com.IntegrationDB</excludedGroups>
            </configuration>

        </plugin>
1

There are 1 answers

0
khmarbaise On BEST ANSWER

First i wouldn't defined the surefire-junitXXX manually. Better let surefire do it's job. Furthermore an excerpt from the docs:

(TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run. For JUnit, this parameter forces the use of the 4.7 provider This parameter is ignored if the suiteXmlFiles parameter is specified.

See also for groups:

http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html#Using_JUnit_Categories