Spring Boot testing: Zero to Hero
summary
Starts from the problem that @SpringBootTest is easy to overuse — tests balloon to 12 minutes and fail randomly — then shows concrete fixes: replace blanket @SpringBootTest with MockMvcTester for API checks, use HtmlUnit-backed WebClient for lightweight browser tests, run a real server with webEnvironment=RANDOM_PORT for session/servlet features, apply Spring Boot test slices to shrink contexts, and integrate Testcontainers for real databases; demos include AssertJ assertions, CSRF-enabled security tests, and context caching to cut repeated startup costs.
AI-written summary · about
chapters (11)
- 0:00Introduction and setup
- 1:07Disclaimers and talk overview
- 3:15Web testing with Mock MVC
- 15:49Browser testing with WebClient
- 24:21Real web server vs mock stack
- 35:45Test context caching
- 48:04Toolbox: AssertJ and Output Capture
- 1:00:11Test slices for focused testing
- 1:12:11Test containers for databases
- 1:30:57Security testing with Spring Security
- 1:47:16Wrap-up and resources
related talks
02h 43mSpring Boot testing: Zero to Hero
53mTesting Spring Boot Applications Demystified
48mTesting Spring Boot Applications Demystified
45mSpring Boot Test - A look behind the curtain
33mThings I Wish I Knew When I Started Testing Spring Boot Applications
50mTesting Spring Boot Applications
51mTesting Spring Boot Applications
44mTesting Web Apps with Spring Framework
