junit-vintage-engine 和 junit-jupiter-engine 之间的区别?

2024-04-27

这是一个双重问题。

  1. 有什么区别junit-vintage-engine and junit-jupiter-engine?
  2. Spring Boot 入门项目排除了junit-vintage-engine。是强制使用junit-jupiter-engine吗?

以下是我的 SpringBoot 项目生成的依赖项春季初始化 https://start.spring.io/:

<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 测试。

据推测,由于您将只为新的 Spring Boot 项目编写 JUnit 5 测试,因此不需要老式引擎,因此 POM 中默认依赖项排除。

参考:

https://junit.org/junit5/docs/current/user-guide https://junit.org/junit5/docs/current/user-guide

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

junit-vintage-engine 和 junit-jupiter-engine 之间的区别? 的相关文章

随机推荐