This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.5.6! |
Testing
Spring Boot provides a number of utilities and annotations to help when testing your application.
Test support is provided by two general-purpose modules – spring-boot-test
contains core items and spring-boot-test-autoconfigure
supports auto-configuration for tests – and several focused -test
modules that provide testing support for a particular feature.
Most developers use the spring-boot-starter-test
starter, which imports both general-purpose Spring Boot test modules as well as JUnit Jupiter, AssertJ, Hamcrest, and a number of other useful libraries, and the focused -test
modules that are applicable to their particular application.
If you have tests that use JUnit 4, JUnit 5’s vintage engine can be used to run them.
To use the vintage engine, add a dependency on
|
hamcrest-core
is excluded in favor of org.hamcrest:hamcrest
that is part of spring-boot-starter-test
.