Testing Spring Boot Applications
summary
Explains why tests should reduce risk not chase percentages, recommends a single context-refresh test as the highest-value start and warns against blind mocking; gives concrete tooling: @MockBean and @SpyBean for slice tests, mock-rest-service-server or OkHttp MockWebServer for HTTP clients, testcontainers or Spring's embedded helpers for real datastores, and details when context caching speeds or slows suites; notes tradeoffs between unit, slice and full integration tests and the move to JUnit 5 in Spring Boot 2.2.
AI-written summary · about
chapters (21)
- 0:00Intro
- 0:30Why Test
- 7:56Unit Tests
- 10:34Naming Tests
- 15:06RestServiceServer
- 20:32Spring Data
- 25:40Test Containers
- 25:55What is Test Containers
- 29:58What is Integration Test
- 32:10Context Cache
- 32:54Integration Test
- 34:50Spring Boot Test Overview
- 40:30Slice Test Support
- 40:44Slice Annotations
- 42:05Example Application
- 44:44Mock Bean
- 45:33Customer Repository
- 45:47Order Repository
- 46:28Mock MVC
- 48:17Spring Boot JUnit 5
- 50:15Outro
related talks
33mThings I Wish I Knew When I Started Testing Spring Boot Applications
53mTesting Spring Boot Applications Demystified
48mTesting Spring Boot Applications Demystified
45mSpring Boot Test - A look behind the curtain
44mThings I Wish I Knew When I Started Testing Spring Boot Applications
02h 43mSpring Boot testing: Zero to Hero
50mTesting Spring Boot Applications
37mImproving Spring Boot test efficiency
