当前位置:网站首页>junit4和junit5区别
junit4和junit5区别
2022-07-17 05:02:00 【dzl84394】
是不是报错
TestEngine with ID ‘junit-vintage‘ failed to discover tests
junit-vintage-engine 是 JUnit 4 中使用的测试引擎。
junit-jupiter-engine 是 JUnit 5 中使用的测试引擎。
import org.junit.Test; //我是4
import org.junit.jupiter.api.Test ; //这里是5
springboot 2.1 之前
使用 junit5 需要配合@ExtendWith(SpringExtension.class)才能正常工作的
springboot 2.1 .*
2.1之后的版本 @SpringBootTest 的已经组合了@ExtendWith(SpringExtension.class),因此,无需在进行该注解的使用了,进一步简化。
springboot <2.4
2.4之前要用junit5,需要去除junit-vintage-engine
(如果报estEngine with ID ‘junit-vintage’ failed to discover tests)
<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>
springboot >2.4
默认JUnit5,如果要用4,需要加junit包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.3.12.RELEASE</version>
<scope>test</scope>
</dependency>
的时候可以用@RunWith(SpringRunner.class)
如果版本大于2.4,则必须配置junit,否则无法使用@RunWith(SpringRunner.class)和org.junit.Assert.*
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
边栏推荐
- Service end interface test - test point of interface test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- Construction and application of knowledge map de (VII): large scale knowledge map pre training
- Real time Bi (IV) low cost data quasi real time processing idea
- 【FPGA教程案例27】通过Verilog实现双口RAM乒乓结构
- Warriors of the Visual Studio, Assemble! (Visual Studio的勇士们,汇编吧!) 原创 2009年07月12日 19:40:00 标签:汇编 /mic
- Kettle5.4 problem record
- 面临的挑战和优势,并预测NeRF最终将取代Deepfake
- TCP/IP 协议
- 知识图谱de构建与应用(六):知识图谱的存储、服务与质量
- Penetration test 10 - scan web directories (dirb, wfuzz, wpscan, Nikto)
猜你喜欢
随机推荐
Notes on Advanced Mathematics: selected exercises of Wu Yue
[vuforia] simple logic of image recognition
知识图谱de构建与应用(五):知识推理
Rk1126 realizes picture in picture function picture in picture for rk 1126
shardingsphere的核心概念和快速实战
py3 redis通用调用
Introduction to redis
Freshman task-5
记录一次存储过程批量修改表结构
And predicts that nerf will eventually replace deepfake
[fuel cell] simulation of fuel cell system control strategy based on Simulink
高等数学笔记:关于等价无穷小替换的一个猜想
Water and electricity meter reading and recharge management system in Colleges and universities in property community
2022最新版校园跑腿小程序源码
Efficient insertion of references in word with thousands of words and many pictures
Simple UI funny text conversion Emoji expression wechat applet supports sentence word conversion_ Source code
Blessing for the elderly popular short video wechat applet source code download support traffic master
Rearrange data according to date JS
Virtual lab basic experiment tutorial -7 Polarization (3)
Codeforces Round #419 (Div. 1)B - Karen and Test



![[TA frost wolf \u may - hundred people plan] Figure 2.5 bump mapping](/img/c6/4c58e2c01c46e76968943bf9ad3311.png)





