首页 > 解决方案 > 迁移到 Spring Boot 2.4.0 后,IT 不再使用故障安全插件执行

问题描述

我有一些使用故障安全插件运行的集成测试。这在 Spring Boot 2.3.5.RELEASE 之前有效,但在迁移到 2.4.0 之后,不再执行 IT。

  1. 有人有同样的问题吗?

  2. 如何调试故障安全以找出未执行测试的原因?

标签: javaspring-bootmaven-failsafe-plugin

解决方案


问题在于 IT 是 Junit4 测试,而 Spring Boot 2.4.0 删除了老式的 Junit 依赖项。

我必须添加以下依赖项。

<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <scope>test</scope>
    <exclusions>
        <exclusion>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>

推荐阅读