Test Driven Development with Spring Boot - Sannidhi Jalukar, Madhura Bhave
summary
Top-down TDD builds a small car service from an integration test down to controller, service and repository, using spring-boot-test with TestRestTemplate, @WebMvcTest + MockMvc, Mockito for unit tests and @DataJpaTest with TestEntityManager so database queries actually flush and reveal missing default constructors and IDs. Caching tests run with @EnableCaching and AutoConfigureTestDatabase and assert the repository is invoked only once. Reactive variant uses WebFlux, WebTestClient and StepVerifier. Live code is on GitHub and most tests go green. TestEntityManager flushes to DB assertJ and Mockito used throughout
AI-written summary · about
chapters (17)
- 0:00Introduction
- 3:10Integration Test
- 10:07Controller Test
- 12:53Web MVC Test
- 14:16Slice Test
- 17:40Corner Test
- 19:32Exception Handling
- 20:32Service Test
- 23:18Unit Test
- 25:31Data JPA Test
- 27:59Spring Data Repository
- 31:15Test every line of code
- 34:07Test Entity Manager
- 44:49Cache
- 48:37Data
- 51:21Application
- 53:57Car Deposit
related talks
44mTDD with Spring Boot - Testing the Harder Stuff
56mLearning Spring Boot with TDD
50mTesting Spring Boot Applications
48mTesting Spring Boot Applications Demystified
53mTesting Spring Boot Applications Demystified
46mHow John Started to Like TDD (Instead of Hating It)
02h 43mSpring Boot testing: Zero to Hero
41mIntegration Testing with Spring
