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);
    }
}
相关推荐
聆听。。花开雨落2 小时前
mybatis的typeHandler 作用
数据库·mybatis
pxzsky3 小时前
PG17数据库安装中分分词插件:pg_jieba
数据库·postgresql·pg_jieba
霸道流氓气质3 小时前
SpringBoot中通用工具类库(Utils)封装与使用实践
spring boot·后端·python
她说可以呀3 小时前
Redis哨兵
数据库·redis·bootstrap
霸道流氓气质4 小时前
KMS 密钥管理服务(Key Management Service)原理与实践
linux·服务器·数据库
kirs_ur4 小时前
CXL(Compute Express Link)— 内存扩展的未来
服务器·数据库·性能优化
MonolithIoT5 小时前
实战方案|设备备件无人值守仓库:连续化产线运维备件 7×24 小时数字化管控方案
运维·网络·数据库
瞬间&永恒~6 小时前
【MySQL】4-6:在同一个主机上使用 systemd 运行多个 MySQL服务器
服务器·数据库·mysql
心机之蛙qee6 小时前
Redis的主从、哨兵及集群
数据库·redis·缓存