How to enjoy E2E testing in Kotlin / Spring
summary
Claims TDD E2E for REST APIs in Kotlin Spring is practical and pleasant, then demonstrates it: tests are functions in Kotest, HTTP calls use WebTestClient, third‑party APIs are stubbed with WireMock while the database runs as a real Postgres in Testcontainers, and MockK replaces beans in Spring. A small client/offices API is driven red‑green‑refactor style, tests run in IntelliJ, server starts and Postman shows the expected JSON, and reusable Testcontainers keeps iteration fast.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 1:05Web app architecture overview
- 2:31Testing strategies in Spring
- 3:54TDD for API development
- 4:58Choosing testing tools
- 6:01Why Kotest for Kotlin
- 7:08Mocking with MockK
- 8:17Testing with real DBs
- 9:21Speeding up tests with Testcontainers
- 9:41Running real servers for E2E
- 10:27Encapsulating API calls
- 11:10Preparing test data
- 12:14Kotlin DSL for test data
- 12:58Optimizing test speed
- 14:24Live coding intro
- 15:27TDD client controller
- 18:22Mocking in demo
- 20:23Adding office creation
- 22:07Testing office inclusion
- 23:39Handling office deactivation
- 26:59Refactoring acceptance criteria
- 27:20Validating app with tests
- 28:06Key takeaways
- 28:26Q&A
related talks
58mSpring and Kotlin: A Winning Combination
50mSupercharge Spring Boot Tests with Kotlin DSL Power
56mLearning Spring Boot with TDD
36mBest Practices for Unit Testing in Kotlin
52mBootiful Testing
01h 29mIntro to unit testing coroutines with Kotest & MockK
32mTesting with Kotlin
44mSpring + Kotlin = Modern + Reactive + Productive
