spring boot 测试用例

依赖包

复制代码
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.2.5.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <version>2.2.6.RELEASE</version>
            <scope>compile</scope>
        </dependency>

目录结构

复制代码
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.*;

@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {

    @org.junit.Test
    public void test() {}
}
相关推荐
上进小菜猪15 小时前
面向课堂与自习场景的智能坐姿识别系统——从行为感知到可视化部署的完整工程【YOLOv8】
后端
BestAns16 小时前
一文带你吃透 Java 反射机制
java·后端
2501_9167665416 小时前
【Springboot】数据层开发-数据源自动管理
java·spring boot·后端
QT 小鲜肉16 小时前
【Linux命令大全】001.文件管理之git命令(实操篇)
linux·服务器·笔记·git·elasticsearch
半夏知半秋16 小时前
docker常用指令整理
运维·笔记·后端·学习·docker·容器
程序员码歌16 小时前
短思考第263天,每天复盘10分钟,胜过盲目努力一整年
android·前端·后端
软件管理系统16 小时前
基于Spring Boot的便民维修管理系统
java·spring boot·后端
源代码•宸17 小时前
Leetcode—620. 有趣的电影&&Q3. 有趣的电影【简单】
数据库·后端·mysql·算法·leetcode·职场和发展
廋到被风吹走17 小时前
【Spring】DispatcherServlet解析
java·后端·spring
码luffyliu18 小时前
系统优化:从压测到性能飞升
后端·压力测试