What does the "default-test" stand for in the maven-surefire plugin

Viewed 12514

I have defined the following configuration in my pom for surefire with TestNg:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <skipTests>${skip-all-tests}</skipTests>
            </configuration>
            <executions>
                <execution>
                    <id>unit-tests</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>${skip-unit-tests}</skip>
                        <groups>unit</groups>

                        <excludedGroups>integration</excludedGroups>
                    </configuration>
                </execution>
                <execution>
                    <id>integration-tests</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <skip>${skip-integration-tests}</skip>
                        <groups>integration</groups>
                        <excludedGroups>unit</excludedGroups>
                    </configuration>
                </execution>
            </executions>
        </plugin>

But it seems the two executions are always preceded by a "default-test" run which seems to run every @test annotated method (at least I think so).

--- maven-surefire-plugin:2.12:test (default-test) @ my-project

For example running "mvn test" on the project, two test executions take place. The "default-test" and the "unit-test".

Could someone explain this a little more to me? Can this be disabled or controlled (configured what is tested and what not)?

2 Answers

Alternatively to the Stephen's solution, if you don't want the following message to be displayed in the log (which in fact is a bit misleading since you are not skipping tests):

[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ service-template ---
[INFO] Tests are skipped.

...then go this way:

                <execution>
                    <id>default-test</id>
                    <phase>none</phase>
                </execution>
Related