1.添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2.测试类上增加注解,classes后面跟的是测试类的类名
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WechatTest.class)
本文介绍如何在 Spring Boot 项目中进行单元测试配置。主要内容包括添加 spring-boot-starter-test 依赖,以及使用 @RunWith 和 @SpringBootTest 注解来运行测试。

219

被折叠的 条评论
为什么被折叠?



