junit-vintage-engine和junit-jupiter-engine之间的区别? [英] Difference between junit-vintage-engine and junit-jupiter-engine?
本文介绍了junit-vintage-engine和junit-jupiter-engine之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是两个问题.
-
junit-vintage-engine
和junit-jupiter-engine
有什么区别? - SpringBoot入门项目带有
junit-vintage-engine
的排除项.是否要强制使用junit-jupiter-engine?
- What is the difference between
junit-vintage-engine
andjunit-jupiter-engine
? - SpringBoot starter projects come with an exclusion for
junit-vintage-engine
. Is it to enforce the use of junit-jupiter-engine?
下面是从 Spring Initializr 生成的SpringBoot项目的依赖项:
Below is the dependency of my SpringBoot project generated from Spring Initializr:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
推荐答案
junit-vintage-engine
用于运行JUnit 4测试. junit-jupiter-engine
用于JUnit 5测试.
junit-vintage-engine
is used for running JUnit 4 tests; junit-jupiter-engine
for JUnit 5 tests.
大概是因为您将只为新的Spring Boot项目编写JUnit 5测试,因此不需要老式引擎,因此POM中的默认依赖项排除.
Presumably since you'll be writing only JUnit 5 tests for a new Spring Boot project, the vintage engine won't be needed, hence the default dependency exclusion in the POM.
参考:
https://junit.org/junit5/docs/current/user-guide
这篇关于junit-vintage-engine和junit-jupiter-engine之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文