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

}
相关推荐
java搬砖工-苤-初心不变3 天前
基于 lua_shared_dict 的本地内存限流实现
开发语言·junit·lua
不要再敲了5 天前
掌握单元测试的利器:JUnit 注解从入门到精通
junit·单元测试
噔噔噔噔@6 天前
BUG排查流程
单元测试
山楂树下懒猴子8 天前
ChatAI项目-ChatGPT-SDK组件工程
人工智能·chatgpt·junit·https·log4j·intellij-idea·mybatis
云动雨颤9 天前
Python单元测试入门:3个核心断言方法,帮你快速定位代码bug
python·单元测试
Suresoft China9 天前
软件测试|STATIC 代码静态验证工具 C/C++ 工具链设置指南
c++·单元测试·静态测试·测试覆盖率·static·代码覆盖率·工具链设置
我发在否10 天前
Lua > OpenResty Lua Module
junit
itppxie10 天前
Simulink中使用Test sequence单元测试
单元测试
一线灵11 天前
跨平台游戏引擎 Axmol-2.8.1 发布
junit·游戏引擎