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);
    }

}
相关推荐
我发在否15 小时前
Lua > OpenResty Lua Module
junit
itppxie16 小时前
Simulink中使用Test sequence单元测试
单元测试
一线灵1 天前
跨平台游戏引擎 Axmol-2.8.1 发布
junit·游戏引擎
泛联新安1 天前
如何根据项目需求选择合适的软件测试工具?iUnit智能单元测试平台提供专业化解决方案
c++·测试工具·单元测试
EndingCoder2 天前
单元测试:Jest 与 Electron 的结合
javascript·electron·单元测试·前端框架
奔跑吧邓邓子3 天前
【Java实战㉖】深入Java单元测试:JUnit 5实战指南
java·junit·单元测试·实战·junit5
川石课堂软件测试3 天前
Oracle 数据库使用事务确保数据的安全
数据库·python·功能测试·docker·oracle·单元测试·prometheus
程序员二黑4 天前
Postman接口测试全攻略:从入门到精通,看这一篇就够了
单元测试·测试·ab测试
OEC小胖胖5 天前
代码质量保障:使用Jest和React Testing Library进行单元测试
前端·react.js·单元测试·前端框架·web
liang_jy5 天前
Android 单元测试(二)—— 高级 Mock 技术
android·面试·单元测试