因此测试引擎不再需要 exclude junit-vintage 到 Spring Boot 的测试依赖了。 2.4.0 的测试实例应该使用下面的依赖配置: <! </scope> </dependency> 这个问题在 2.3.3 的版本出现了上面的问题,有关这个问题的描述和解决方法,请参考:JUnit 5 测试 Spring 引擎的时候提示 junit-vintage 测试引擎 junit-vintage 主要是版本兼容性的问题。 https://www.ossez.com/t/spring-2-4-0-junit-vintage/13243
在 Spring 项目中运行测试的时候,得到错误: TestEngine with ID 'junit-vintage' failed to discover tests” with Spring 这个错误的原因是 JUnit 的引擎,使用了 junit-vintage 引擎。 junit-vintage 是 Junit 4 中使用的引擎,如果你的项目使用了 Junit 5 的话,你需要在 spring-boot-starter-test 中将 JUnit 4 的引擎从测试中删除
junit-vintage:用于兼容junit3,junit4的测试引擎。
// platformVersion '1.0.0' filters { engines { // include 'junit-jupiter', 'junit-vintage
test { useJUnitPlatform { excludeTags 'slow' includeEngines 'junit-vintage'
test { useJUnitPlatform { excludeTags 'slow' includeEngines 'junit-vintage'
test { useJUnitPlatform { excludeTags 'slow' includeEngines 'junit-vintage'