Making Your Testcontainers Experience Smoother
summary
Shows concrete Testcontainers for Java tactics: use the MySQL and Elasticsearch modules, enable TLS via the module CA helper, run migrations once then snapshot and restore instead of rerunning, mark containers static or start them globally once and in parallel, use ram-backed volumes, increase Maven Surefire/Failsafe forks, enable testcontainers.reuse for local caching, profile with Java Flight Recorder + junit-jfr; measured runtime drops from ~4 minutes to 1:17 to 30s to 21s and finally ~5s.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 3:15Testcontainers assumptions
- 8:30Problematic test setup
- 16:19Separate fast and slow tests
- 18:52Optimizing integration test runtime
- 21:21Static containers for test classes
- 24:27Parallel container startup
- 26:32Global container initialization
- 28:56Avoiding repeated migrations
- 31:26Measuring test performance
- 34:59Increasing test forks
- 37:10Optimizing storage with RAM disk
- 39:19Reusing container snapshots
- 42:09Maximizing reuse with properties
- 44:42Key takeaways summary
- 46:51Feedback and resources
related talks
45mTestcontainers - a Year-in-review
53mTestcontainers: a year-in-review
01h 06mTestcontainers best practices.
15mTestcontainers: Simplify Your Integration Tests and Development
26mSimplify Your Dev Life with Testcontainers
46mTestcontainers - The past, the present and the future
13mImproving Integration Tests using Testcontainers
21mTest Containers: Where Every Test Starts Fresh
