How to run JUnit 5 integration tests with the Maven Failsafe plugin?

The Mail Failsafe plugin will not find my JUnit 5 integration tests, although it can find files.

I have junit-jupiter-api, and junit-jupiter-enginehow to test the relationship:

<properties>
    <junit.jupiter.version>5.0.1</junit.jupiter.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

My integration tests are named correctly following **/*IT.java, **/IT*.javaor **/*ITCase.java, which by default were enabled by Failsafe and by default excluded by Surefire.

Is there a way I can use JUnit 5 tests with Failsafe?

+4
source share
1 answer

maven-failsafe-plugin does not support JUnit 5 , out of the box.

, maven-surefire-plugin, JUnit 5 maven-failsafe-plugin, org.junit.platform:junit-platform-surefire-provider:1.0.1 maven-failsafe-plugin:2.19.1.

2.20 ( , surefire ) - OutOfMemory.

:

<properties>
    <junit.platform.version>1.0.1</junit.platform.version>
</properties>

<plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <dependencies>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-surefire-provider</artifactId>
            <version>${junit.platform.version}</version>
        </dependency>
    </dependencies>
</plugin>
+6

Source: https://habr.com/ru/post/1688610/


All Articles