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

}
相关推荐
SoleMotive.2 天前
redis实现漏桶算法--https://blog.csdn.net/m0_74908430/article/details/155076710
redis·算法·junit
꧁༺℘₨风、凌๓༻꧂3 天前
C# MES .NET Framework Winform 单元测试
单元测试·c#·.net
虹科网络安全3 天前
艾体宝干货 | Redis Python 开发系列#4 保证原子性与性能
redis·python·junit
我发在否3 天前
OpenResty > 平滑升级:1.25.x → 1.27.x
junit·openresty
IMPYLH3 天前
Lua 的 pairs 函数
开发语言·笔记·后端·junit·单元测试·lua
倚肆3 天前
Spring Boot 测试注解全解:从单元测试到集成测试
spring boot·单元测试·集成测试
安冬的码畜日常3 天前
【JUnit实战3_35】第二十二章:用 JUnit 5 实现测试金字塔策略
测试工具·junit·单元测试·集成测试·系统测试·bdd·测试金字塔
码农BookSea4 天前
用好PowerMock,轻松搞定那些让你头疼的单元测试
后端·单元测试
少云清4 天前
【软件测试】5_测试理论 _软件测试分类(重点)
软件测试·单元测试·uat测试·sit测试
秃了也弱了。5 天前
testng:Java界功能强大的单元测试框架
java·单元测试·log4j