JUnit 5 单元测试框架

依赖安装

复制代码
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

所有支持的注解都在包 org.junit.jupiter.api 下。

基本使用:

java 复制代码
import org.junit.Assert;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;

@SpringBootTest
public class SampleTest {

    @Resource
    private UserMapper userMapper;

    @Test
    public void testSelect() {
        System.out.println(("----- selectAll method test ------"));
        List<User> userList = userMapper.selectList(null);
        Assert.assertEquals(5, userList.size());
        userList.forEach(System.out::println);
    }

}
相关推荐
aLTttY1 小时前
Spring Boot + Redis 实现接口防抖与限流实战指南
spring boot·redis·junit
以为你知道啊7 小时前
mini-job极简分布式延迟任务队列 — 基于 Redis,支持 Cron 周期任务、异步协程和多执行器
redis·分布式·junit
汽车仪器仪表相关领域7 小时前
Kvaser Memorator Light HS v2:单通道 CAN FD 便携记录仪,即插即用的故障诊断利器
运维·服务器·数据库·人工智能·功能测试·单元测试
QH139292318801 天前
Rohde & Schwarz FSWX3044 FSWX3026信号与频谱分析仪
网络·功能测试·单元测试·集成测试·模块测试
胡利光1 天前
Harness Engineering 05|Safety & HITL Harness:边界、接管与回滚
junit
川石课堂软件测试1 天前
AI如何赋能软件测试行业的发展
人工智能·python·功能测试·网络协议·单元测试·测试用例·prometheus
上海合宙LuatOS1 天前
LuatOS扩展库API——【xmodem】文件传输协议
物联网·junit·luatos
seabirdssss2 天前
以登录功能理解单元测试、集成测试、系统测试和用户测试
单元测试·集成测试
琪露诺大湿2 天前
VeloQueue-测试报告
java·开发语言·消息队列·单元测试·项目·测试报告