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);
    }
}
相关推荐
cyber_两只龙宝几秒前
【Oracle】Oracle之SQL的转换函数和条件表达式
linux·运维·数据库·sql·云原生·oracle
Lucifer三思而后行4 分钟前
中国移动 BCLinux 8.8 一键安装 Oracle 26ai
数据库·oracle
wuyikeer6 分钟前
Spring Boot 经典九设计模式全览
java·spring boot·设计模式
djjdjdjdjjdj6 分钟前
bootstrap如何修改警告框(Alert)的边框粗细
jvm·数据库·python
HalvmånEver9 分钟前
MySQL的数据类型(一)
数据库·mysql
tjc1990100519 分钟前
golang如何使用t.Cleanup清理测试_golang t.Cleanup测试清理使用策略
jvm·数据库·python
SeSs IZED22 分钟前
Redis开启远程连接
数据库·redis·缓存
214396531 分钟前
如何提升SQL数据更新的安全性_使用行级锁与悲观锁机制
jvm·数据库·python
uElY ITER39 分钟前
VS与SQL Sever(C语言操作数据库)
c语言·数据库·sql
SHoM SSER1 小时前
SQL之CASE WHEN用法详解
数据库·python·sql