No More SQLite - How to Write Tests With EF Core Using TestContainers
summary
A live demo spins up TestContainers Postgres containers for EF Core integration tests with one-line setup/start/teardown, uses randomized ports and sensible defaults, and relies on the Ryuk resource reaper for cleanup. Tests use xUnit collection fixtures to control parallelism and Respawn to reset the public schema between tests. Observed runtimes: about 7.5s for nine tests across three containers; a few hundred tests also ran without notable slowdown (~5–7s reported).
AI-written summary · about
chapters (10)
- 0:00The problem with sqlite
- 2:39Testing another system
- 4:51Cost of debugging
- 6:16Testing alternatives
- 8:52Introduction to Testcontainers
- 11:05Coding demo part 1
- 20:14State management with Respawn
- 24:05Advanced test practices
- 28:57Podman and reusability
- 30:17Recap and conclusions
related talks
56mDitch SQLite! Write Reliable EF Core Tests with Testcontainers
28mPostmortem: TDD with TestContainers
59mIntegration and end-to-end testing with TestContainers and JUnit 5
39mAndres Almiray: Setting Up Data Driven Tests
45mTestcontainers - a Year-in-review
40mIntegration tests & testContainers
21mTest Containers: Where Every Test Starts Fresh
15mSimplified Unit Testing with the Entity Framework Core InMemory Provider
