Spring Boot applications are tested at different levels:
| Test Type | Scope | Tools Used | What It Tests |
|---|---|---|---|
| Unit Tests | Smallest unit of code (e.g., methods, classes) | JUnit, Mockito | Individual methods or classes |
| Web Layer Tests | Only the Controller layer | Spring @WebMvcTest, MockMvc |
API endpoints (without service/database layer) |
| Integration Tests | Whole application (including DB) | @SpringBootTest, Testcontainers |
Full system behavior with all layers |
| End-to-End (E2E) Tests | Tests the entire app as a user would | Selenium, Cucumber | Full user workflows |