TestContainers – integration testing without the hassle
summary
Library Demo: a Java library named TestContainers runs throwaway Docker containers from JUnit (uses JUnit rules) to provide real Redis/Postgres/Elasticsearch and a mock-server container for isolated integration tests. Examples show a Redis-backed cache test and an agent test that starts a Groovy app inside a container with the built agent jar mapped in, uses a random host port mapping so many tests run concurrently, pulls images from Docker Hub, and passes/fails as expected.
AI-written summary · about
chapters (12)
- 0:00Introduction and voice recovery
- 1:26About me and TestContainers
- 6:45Why integration testing matters
- 7:06Challenges of integration tests
- 9:15Requirements for good tests
- 11:28Docker and TestContainers adoption
- 13:59How TestContainers works
- 15:44Hello world demo
- 23:49Testing microservices with TestContainers
- 28:10Testing Java agents
- 38:28Agent test demo
- 39:48Summary and resources
