JUnit 4 + Spring Boot 测试依赖

1.pom导入依赖

复制代码
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

2.在src同目录下创建test/java

3.编写测试类

复制代码
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;



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

    @Test
    public void testSqlOutput() {
        System.out.println(111);
    }
}
相关推荐
冉冰学姐27 分钟前
SSM公办小学网络报名系统f3d3p(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·ssm 框架·公办小学网络报名系统·教育信息化
叡鳍1 小时前
hive---HQL查询
数据库
vortex51 小时前
谷歌黑客语法挖掘 SQL 注入漏洞
android·数据库·sql
九河云2 小时前
软件开发平台 DevCloud
运维·服务器·数据库·科技·华为云
wind_one13 小时前
7.基础--SQL--DDL-数据类型及案例
数据库·sql
ruleslol4 小时前
SpringBoot面试题03-BeanFactory
spring boot
l1t4 小时前
利用DeepSeek改写SQLite版本的二进制位数独求解SQL
数据库·人工智能·sql·sqlite
QT 小鲜肉4 小时前
【QT/C++】Qt定时器QTimer类的实现方法详解(超详细)
开发语言·数据库·c++·笔记·qt·学习
研究司马懿4 小时前
【ETCD】ETCD常用命令
网络·数据库·云原生·oracle·自动化·运维开发·etcd
刘一说5 小时前
深入理解 Spring Boot 中的数据库迁移:Flyway 与 Liquibase 实战指南
数据库·spring boot·oracle