SpringBoot2 单元测试类的报错问题
2024-09-06 17:20:19
问题描述
执行 SpringBoot2 测试时报错,提示找不到 SsmApplicationTests 主类
原因分析
Junit5 升级了框架没有兼容
问题解决
<!--测试模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
测试类
org.junit.jupiter.api.Test;
替换成
import org.junit.Test;
最新文章
- 对于C++窗口编译一闪而过的解决方法 (DEV CPP下)
- java - Annotation元数据
- dictionaryWithObjectsAndKeys
- 20145102 《Java程序设计》第4周学习总结
- TypeScript 素描 - 模块
- 常用布局,div竖直居中
- MKMapView移动事件地图
- 动手学习TCP:数据传输(转)
- 使用JSmooth制造java jar文件可以运行exe文件教程图像
- akoj-1148-小光棍数
- 区块链 编译android geth 填坑记录 ubuntu
- Python多线程的简单实现(生产者消费者模型)
- python中各个response使用
- 30个极大提高开发效率的vscode插件
- python 面向对象编程(初级篇)
- 在Qt项目中如何添加一个已有的项目作为子项目
- js的this到底是什么意思
- 数据库——SQL数据单表查询
- springboot中定时任务
- Storm集成Kafka的Trident实现