Junit5 系列索引

junit5 入门系列教程-01-junit5 简单入门例子
<https://blog.csdn.net/ryo1060732496/article/details/80792246>

junit5 入门系列教程-02-junit5 注解详解
<https://blog.csdn.net/ryo1060732496/article/details/80812102>

junit5 入门系列教程-03-junit5 测试类和方法
{@Test、@RepeatedTest、@ParameterizedTest、@TestFactory或@TestTemplate}
<https://blog.csdn.net/ryo1060732496/article/details/80812148>

junit5 入门系列教程-04-junit5 展现名称(@DisplayName)
<https://blog.csdn.net/ryo1060732496/article/details/80812210>

junit5 入门系列教程-05-junit5 断言(assert)
<https://blog.csdn.net/ryo1060732496/article/details/80812240>

junit5 入门系列教程-06-junit5 假设(Assumptions)
<https://blog.csdn.net/ryo1060732496/article/details/80812262>

junit5 入门系列教程-07-junit5 禁用(@Disabled)
<https://blog.csdn.net/ryo1060732496/article/details/80812293>

junit5 入门系列教程-08-junit5 条件执行(@EnabledXXX, @DisabledXXX)
<https://blog.csdn.net/ryo1060732496/article/details/80812395>

junit5 入门系列教程-09-junit5 标签和过滤(@Tag)
<https://blog.csdn.net/ryo1060732496/article/details/80812423>

junit5 入门系列教程-10-junit5 测试实例生命周期(@TestInstance)
<https://blog.csdn.net/ryo1060732496/article/details/80812455>

junit5 入门系列教程-11-junit5 内嵌测试(@Nested)
<https://blog.csdn.net/ryo1060732496/article/details/80812480>

junit5 入门系列教程-12-junit5 依赖注入构造器、方法
<https://blog.csdn.net/ryo1060732496/article/details/80823635>

junit5 入门系列教程-13-junit5 测试接口及默认方法
<https://blog.csdn.net/ryo1060732496/article/details/80823661>

junit5 入门系列教程-14-junit5 重复测试(@RepeatedTest)
<https://blog.csdn.net/ryo1060732496/article/details/80823682>

junit5 入门系列教程-15-junit5 参数化测试(@ParameterizedTest)
<https://blog.csdn.net/ryo1060732496/article/details/80823696>

junit5 入门系列教程-16-junit5 测试模板(@TestTemplate)
<https://blog.csdn.net/ryo1060732496/article/details/80823712>

junit5 入门系列教程-17-junit5 动态测试(DynamicTest)
<https://blog.csdn.net/ryo1060732496/article/details/80823726>

junit5 入门系列教程-18-junit5 拓展模块-总览(Extend Model)
<https://blog.csdn.net/ryo1060732496/article/details/80823863>

junit5 入门系列教程-19-junit5 拓展实体-注册(Register Extension)
<https://blog.csdn.net/ryo1060732496/article/details/80823898>

junit5 入门系列教程-20-junit5 拓展实体-条件测试
<https://blog.csdn.net/ryo1060732496/article/details/80823912>

junit5 入门系列教程-21-junit5 拓展实体-测试实例后处理(Instance Post-processing)
<https://blog.csdn.net/ryo1060732496/article/details/80823947>

junit5 入门系列教程-22-junit5 拓展实体-参数化测试解决方案(Parameter Resolution)
<https://blog.csdn.net/ryo1060732496/article/details/80837572>

junit5 入门系列教程-23-junit5 拓展实体-异常处理器(Exception Handle)
<https://blog.csdn.net/ryo1060732496/article/details/80837585>

junit5 入门系列教程-24-junit5 拓展实体-测试上下文(Test Context)
<https://blog.csdn.net/ryo1060732496/article/details/80837591>

junit5 入门系列教程-25-junit5 拓展实体-存储状态(Keeping State in Extensions)
<https://blog.csdn.net/ryo1060732496/article/details/80837607>

junit5 入门系列教程-26-junit5 拓展实体-工具类
<https://blog.csdn.net/ryo1060732496/article/details/80837611>

junit5 入门系列教程-27-junit5 拓展实体-用户代码和扩展的相对执行顺序
<https://blog.csdn.net/ryo1060732496/article/details/80837621>

junit5 入门系列教程-28-junit5 拓展实体-测试生命周期回调
<https://blog.csdn.net/ryo1060732496/article/details/80837579>

junit5 入门系列教程-29-junit5 拓展实体-Junit 平台启动器API(JUnit Platform Launcher API)
<https://blog.csdn.net/ryo1060732496/article/details/80837634>

junit5 入门系列教程-30-junit5 实战例子 junit performance
<https://blog.csdn.net/ryo1060732496/article/details/80882265>

目录



* Junit5 系列索引
<https://blog.csdn.net/ryo1060732496/article/details/80792246#junit5-系列索引>
* 目录 <https://blog.csdn.net/ryo1060732496/article/details/80792246#目录>
* Junit5 <https://blog.csdn.net/ryo1060732496/article/details/80792246#junit5>
* 简介 <https://blog.csdn.net/ryo1060732496/article/details/80792246#简介>
* JDK 支持 <https://blog.csdn.net/ryo1060732496/article/details/80792246#jdk-支持>
* 快速开始 <https://blog.csdn.net/ryo1060732496/article/details/80792246#快速开始>
* Maven 导入
<https://blog.csdn.net/ryo1060732496/article/details/80792246#maven-导入>
* 测试案例 <https://blog.csdn.net/ryo1060732496/article/details/80792246#测试案例>
* 变化 <https://blog.csdn.net/ryo1060732496/article/details/80792246#变化>
* 代码地址 <https://blog.csdn.net/ryo1060732496/article/details/80792246#代码地址>
* 文档参考 <https://blog.csdn.net/ryo1060732496/article/details/80792246#文档参考>


Junit5

JUnit5 <https://junit.org/junit5/> is the next generation of JUnit.

目标是为JVM上的开发人员端测试创建一个最新的基础。这包括关注Java 8和以上版本,以及支持多种不同的测试风格。

JUnit 5是JUnit Lambda和它在Indiegogo上的众筹活动的结果。

简介
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage
* JUnit Platform
JUnit Platform 作为在JVM上启动测试框架的基础。
它还定义了TestEngine API,用于开发在平台上运行的测试框架。
此外,该平台提供了一个控制台启动器,用于从命令行启动平台,并为Gradle和Maven构建插件,以及一个基于JUnit
4的运行器,用于在平台上运行任何TestEngine。

* JUnit Jupiter
JUnit Jupiter 是新的编程模型和扩展模型的组合,用于在JUnit 5中编写测试和扩展。
Jupiter子项目为运行基于平台的测试提供了一个测试引擎。

* JUnit Vintage
JUnit Vintage 为在平台上运行基于JUnit 3和JUnit 4的测试提供了一个测试引擎。

JDK 支持

JUnit 5在运行时要求Java 8(或更高)。但是,您仍然可以测试使用JDK的以前版本编译的代码。

快速开始

Maven 导入
<dependencies> <dependency> <groupId>org.junit.platform</groupId> <artifactId>
junit-platform-launcher</artifactId> <version>1.2.0</version> <scope>test</scope
> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>
junit-jupiter-engine</artifactId> <version>5.2.0</version> <scope>test</scope>
</dependency> <dependency> <groupId>org.junit.vintage</groupId> <artifactId>
junit-vintage-engine</artifactId> <version>5.2.0</version> <scope>test</scope>
</dependency> </dependencies>
测试案例

* FirstJUnit5Tests.java import org.junit.jupiter.api.Test; import static
org.junit.jupiter.api.Assertions.assertEquals;public class FirstJUnit5Tests {
@Test void myFirstTest() { assertEquals(2, 1+1); } }
变化

*
导入的包路径和原来不同

*
方法不必再声明为 public

代码地址

FirstJUnit5Tests
<https://github.com/houbb/jdk/blob/master/jdk-junit5/src/test/java/com/github/houbb/jdk/junit5/hw/FirstJUnit5Tests.java>

文档参考

user-guide <https://junit.org/junit5/docs/current/user-guide/#writing-tests>

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信