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