Spring Office Hours

S5E11 - Testing Spring Boot Applications with Daniel Garnier-Moiroux

Mar 30, 2026
Daniel Garnier-Moiroux, a Spring Security engineer and author, talks testing strategies for Spring Boot and his new book. He covers trade-offs of full-context tests, faster TDD-friendly workflows, and using test slices and Modulith for focused testing. They also explore AI-generated tests, when to trust them, and how to keep tests useful as documentation.
Ask episode
AI Snips
Chapters
Books
Transcript
Episode notes
ADVICE

Use TDD For Instant Feedback During Development

  • Use TDD to keep a very fast feedback loop when developing so tests run instantly while you iterate.
  • Daniel explains TDD as write a failing test, implement the simplest fix, then refactor, running tests multiple times per minute for quick design guidance.
INSIGHT

@SpringBootTest Can Inflate Test Suite Time

  • Avoid sprinkling @SpringBootTest everywhere because each annotated test starts or reuses cached Spring applications and can bloat your suite.
  • Daniel describes the test context cache limits and long entity scans that can add seconds per test and turn suites into 15‑minute runs.
ADVICE

Always Review and Tighten Agent‑Generated Tests

  • Use AI agents to generate tests but always review and refine the generated tests as the authoritative specification of intent.
  • Daniel recommends focusing review on tests (the ground truth), pruning irrelevant cases, renaming for clarity, and ensuring tests express intent not just code description.
Get the Snipd Podcast app to discover more snips from this episode
Get the app