roadmap
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
Prepare for Testcontainers interview questions on testing JVM code against real databases and brokers in throwaway containers. Covers lifecycle, modules, networking, Spring Boot, reuse and CI.
65 of 65 questions in your plan: 0 known, 0 in progress, 0 due, 0 skipped, 65 new. 0 cut, outside your plan.
Testcontainers rarely gets a round of its own. It comes up inside a Java or Kotlin backend loop when the talk turns to how persistence and messaging code is tested, and in SDET loops when the question is how a suite gets a real database without a shared test environment. Interviewers tend to bring a failing test rather than ask for definitions: a repository test that is green on H2 and red against PostgreSQL in production, a test that hardcodes port 5432 and breaks on the build server, a suite in which every class starts its own Kafka broker.
What they listen for is the mechanism behind each symptom. The container's port is published on a random host port, so the address exists only after start and comes from getMappedPort(). A listening port is not a ready service, which is what wait strategies are for. An instance @Container field gets a fresh container for every test method. When the JVM is killed, the Ryuk sidecar, not the test, removes what was left. From senior level the questions widen to the suite as a whole: sharing one container without sharing state between tests, keeping Spring's test context cache warm, and choosing between a mounted socket, a remote daemon and Docker-in-Docker on a CI runner.
Every Testcontainers question assumes you can say why the test needs a real dependency at all, so the plan opens on testing, not containers. Integration testing names the boundary being exercised, substitution boundaries decide when a double or an embedded database stops telling the truth, and test isolation is the property a shared container will later put at risk.
The product itself begins with its core API and lifecycle: a generic container, the JUnit 5 extension that starts and stops it, and the reaper that cleans up after a crash. Module containers follow, the ready-made PostgreSQL, Kafka and LocalStack wrappers most real tests use. Then the plan asks how a test reaches what it started. Two Docker leaves come first on purpose: port publishing explains the random host port, and embedded DNS explains why a network alias resolves between containers but not from the test. With those in place, mapped ports, shared networks and wait strategies read as consequences rather than rules to memorize.
Application Wiring hands the running container to a framework. Spring Boot's integration covers test configuration, context caching and containers at development time. Two Spring annotations then carry connection details into the context: @ServiceConnection derives them from the container, and @DynamicPropertySource is the manual route that still covers what the first cannot.
The last stretch concerns a suite that has grown and runs somewhere other than your laptop. Custom images and Compose handle mirrored registries, init scripts and multi-service stacks, and reuse and performance trade start-up time against isolation. The plan ends in CI, where the Docker socket and the root-equivalent access it grants come just before the runner setups that depend on it.
Preparing for a backend loop where Testcontainers sits beside Spring and JUnit, the first three stretches and the Spring Boot wiring are where most questions land: narrow level to your target range, raise importance to must know and work through them by frequency. Platform owners, whether an SDET or whoever keeps the build fast, should study by topics through to the end, since reuse, image mirrors and CI runners are where their interviews go deep; the [Java SDET roadmap](/roadmaps/java-sdet) places this tree among the rest of that job. If your projects only ever used `@ServiceConnection`, go back to the lifecycle first: the follow-up question is usually about what that annotation does for you. The plan is Testcontainers for Java, with Spring Boot's support for it; the Go, .NET, Node.js and Python versions share the idea but not the API. Docker appears only where a test leans on it. How images are built, how the engine runs and how a host is hardened belong to the [Docker roadmap](/roadmaps/docker), and the language, Spring and data access around these tests to the [Java Backend Developer roadmap](/roadmaps/java-developer).
Preparing for a backend loop where Testcontainers sits beside Spring and JUnit, the first three stretches and the Spring Boot wiring are where most questions land: narrow level to your target range, raise importance to must know and work through them by frequency. Platform owners, whether an SDET or whoever keeps the build fast, should study by topics through to the end, since reuse, image mirrors and CI runners are where their interviews go deep; the Java SDET roadmap places this tree among the rest of that job. If your projects only ever used @ServiceConnection, go back to the lifecycle first: the follow-up question is usually about what that annotation does for you.
The plan is Testcontainers for Java, with Spring Boot's support for it; the Go, .NET, Node.js and Python versions share the idea but not the API. Docker appears only where a test leans on it. How images are built, how the engine runs and how a host is hardened belong to the Docker roadmap, and the language, Spring and data access around these tests to the Java Backend Developer roadmap.