I'm trying to set up the followings :
1 During the test phase of maven i only want fast test to execute
2 I want integration (slow test) to execute during verify phase
Here is my config '''
</dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<groups>fast,slow</groups>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<groups>fast</groups>
<excludedGroups>slow</excludedGroups>
</configuration>
</plugin>
'''
When i execute mvn test, only fast tests get executed, good.
But when i execute mvn verify (for sonar) i also only get fast, but i want fast and slow. I think i misunderstanding how failsafe works with surefire.
Thanks for your help
For people like me. You often see Failsafe plugin used to separate fast and slow test. In fact, failsafe is used to configure CI tests from Unit tests. If you only want to separate fast and slow test, juste configure categories and profiles :
<profiles>
<profile>
<id>SlowTests</id>
<properties>
<groups>slow</groups>
</properties>
</profile>
<profile>
<id>FastTests</id>
<properties>
<groups>com.decathlon.kpi.category.FastTest</groups>
</properties>
</profile>
</profiles>
And the test category :
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Tag("fast")
public @interface FastTest {
}