JUnit 5 示例项目教程

JUnit 5 示例项目教程

junit5-samplesCollection of sample applications using JUnit 5.项目地址:https://gitcode.com/gh_mirrors/ju/junit5-samples

1. 项目的目录结构及介绍

JUnit 5 示例项目的目录结构如下:

junit5-samples/
├── junit5-jupiter-starter-ant/
├── junit5-migration-gradle/
├── junit5-migration-maven/
├── junit5-modular-world/
├── junit5-multiple-engines/
├── junit5-exception-testing-example/
├── junit5-assumptions/
├── junit5-nested-test-example/
├── junit5-dynamic-test-example/
├── junit5-maven-example/
├── junit5-spring-boot-example/
├── junit5-tag-filter-example/
├── junit5-test-suite-example/
├── junit5-timeout-example/
└── README.md

目录结构介绍

  • junit5-jupiter-starter-ant/: 展示了如何在 Ant 中使用 JUnit Jupiter。
  • junit5-migration-gradle/: 展示了如何在 Gradle 项目中设置 JUnit Platform、JUnit Jupiter 和 JUnit Vintage。
  • junit5-migration-maven/: 展示了如何在 Maven 项目中设置 JUnit Platform、JUnit Jupiter 和 JUnit Vintage。
  • junit5-modular-world/: 展示了如何在模块化的世界中测试代码,并实现自定义的 TestEngine。
  • junit5-multiple-engines/: 展示了如何在 Gradle 项目中使用 JUnit Platform 和多个 TestEngine。
  • junit5-exception-testing-example/: 展示了如何进行异常测试。
  • junit5-assumptions/: 展示了如何使用假设(Assumptions)。
  • junit5-nested-test-example/: 展示了如何进行嵌套测试。
  • junit5-dynamic-test-example/: 展示了如何在运行时生成动态测试。
  • junit5-maven-example/: 展示了如何在 Maven 项目中使用 JUnit 5。
  • junit5-spring-boot-example/: 展示了如何在 Spring Boot 项目中使用 JUnit 5。
  • junit5-tag-filter-example/: 展示了如何进行标签过滤。
  • junit5-test-suite-example/: 展示了如何创建测试套件。
  • junit5-timeout-example/: 展示了如何进行超时测试。
  • README.md: 项目的介绍文件。

2. 项目的启动文件介绍

每个子项目的启动文件可能会有所不同,但通常会包含一个主要的测试类或配置文件。以下是一些示例:

junit5-jupiter-starter-ant/

  • src/test/java/com/example/junit5/ant/AntTest.java: 主要的测试类。

junit5-migration-gradle/

  • src/test/java/com/example/junit5/migration/gradle/GradleTest.java: 主要的测试类。

junit5-migration-maven/

  • src/test/java/com/example/junit5/migration/maven/MavenTest.java: 主要的测试类。

junit5-modular-world/

  • src/test/java/com/example/junit5/modular/world/ModularWorldTest.java: 主要的测试类。

junit5-multiple-engines/

  • src/test/java/com/example/junit5/multiple/engines/MultipleEnginesTest.java: 主要的测试类。

3. 项目的配置文件介绍

每个子项目的配置文件也会有所不同,但通常会包含构建配置文件和测试配置文件。以下是一些示例:

junit5-jupiter-starter-ant/

  • build.xml: Ant 构建文件。

junit5-migration-gradle/

  • build.gradle: Gradle 构建文件。

junit5-migration-maven/

  • pom.xml: Maven 构建文件。

junit5-modular-world/

  • module-info.java: Java 模块描述文件。
  • build.gradle: Gradle 构建文件。

junit5-multiple-engines/

  • build.gradle: Gradle 构建文件。

junit5-samplesCollection of sample applications using JUnit 5.项目地址:https://gitcode.com/gh_mirrors/ju/junit5-samples

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

叶妃习

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值