test slice
A Spring Boot test that starts only one layer of the application, such as the web layer with @WebMvcTest, to stay fast.
In more detail
A web slice loads controllers, advice, filters and validation but not services or databases, which are replaced by test doubles. Choose the smallest test that proves the behaviour, and add a full context test when wiring is the risk.
Related terms
- MockMvc — Spring's test tool that sends requests through the full Spring MVC machinery to your controllers without opening a real network port.
- @SpringBootTest — The Spring Boot test annotation that starts the complete application context, proving that all the wiring works together.
- test double — Any object that replaces a real dependency in a test: a stub returns canned data, a fake is a small working implementation, and a mock checks interactions.
Taught in
- Testing APIs With MockMvc — Modern Java: Virtual Threads & High-Throughput Services