测试
Spring Boot 提供了许多 Utilities 和 Comments,以帮助测试您的应用程序。
测试支持由两个模块提供:spring-boot-test包含核心物品,以及spring-boot-test-autoconfigure支持测试的自动配置。
大多数开发人员使用spring-boot-starter-teststarter,它导入 Spring Boot 测试模块以及 JUnit Jupiter、AssertJ、Hamcrest 和许多其他有用的库。
|
如果您有使用 JUnit 4 的测试,则可以使用 JUnit 5 的 vintage 引擎来运行它们。
要使用 vintage 引擎,请添加对
|
hamcrest-core被排除在外,以支持org.hamcrest:hamcrest那是spring-boot-starter-test.