Writing Integration Tests Using @SpringBootTest
Let’s explore the @SpringBootTest annotation to write integration tests for components like controllers, services, and repositories.
We'll cover the following...
The spring Boot testing framework provides the @SpringBootTest
annotation that loads the complete application configuration and allows us to use the MockMvc
with the @AutoConfigureMockMvc
annotation to test through all the layers—controller, service, and repository.
The TodoAppIntegrationTest
class
Let’s create the TodoAppIntegrationTest
class in the io.educative.integration
package. It’s annotated with the @SpringBootTest
and @AutoConfigureMockMvc
annotations, as well as injected with ...