liveBook · Manning

Testcontainers

Testcontainers is a library for programmatically running and managing disposable containerized dependencies and environments during automated tests and development.

How 5 Manning books explain it

Build Financial Software with Generative AI (From Scratch)

Testcontainers is a library for creating and managing disposable containerized dependencies for automated tests.

How it is used
Isolates database-backed tests so API and persistence checks can run reliably in CI/CD.
How deep it goes
Demonstrates a pytest DockerCompose fixture that starts and stops a fresh database for an API status test.
Examples
Uses a DockerCompose pytest fixture to test GET /api/v1/companies against a fresh database.
What you can do after
Operate/configure it to run self-contained database-backed tests without a developer-specific running container.

Read how Build Financial Software with Generative AI (From Scratch) explains Testcontainers →

Kafka Streams in Action, Second Edition

Testcontainers is a library for running disposable containerized dependencies during automated tests and managing their lifecycle.

How it is used
Runs a disposable Kafka broker for JUnit integration tests that exercise Kafka Streams against live infrastructure.
How deep it goes
Explains annotations, container scope, broker configuration, startup waiting, production, consumption, assertions, and teardown.
Examples
Uses a KafkaContainer, timestamped records, hopping-window counts, output-topic consumption, and expected-record assertions.
What you can do after
Operate/configure Kafka integration tests with managed containers, broker endpoints, lifecycle control, test data, and cleanup.

Read how Kafka Streams in Action, Second Edition explains Testcontainers →

gRPC Microservices in Go

Testcontainers is a library ecosystem for programmatically creating and managing disposable containerized dependencies during tests.

How it is used
Provisions running dependencies for database-adapter integration tests and an application stack for end-to-end tests.
How deep it goes
Works through suite setup, container readiness, endpoint use, assertions, and stack teardown without examining Testcontainers internals.
Examples
Uses Order service Save and Get assertions against MySQL and a gRPC Create and Get flow against a Compose stack.
What you can do after
Apply it via testcontainers-go to test an adapter against MySQL and use LocalDockerCompose to start and stop a gRPC test stack.

Read how gRPC Microservices in Go explains Testcontainers →

BDD in Action, Second Edition

Testcontainers is an open-source library that provides lightweight, disposable containerized dependencies for automated tests.

How it is used
Supplies Docker-managed databases and services for automated integration and acceptance tests.
How deep it goes
Explains dependency setup, container startup, reuse, thread safety, and framework integration, but does not detail Docker internals.
Examples
Uses PostgreSQL startup, shared and thread-local containers, and Spring Boot properties wired into Cucumber step definitions.
What you can do after
Operate/configure containerized test dependencies and connect their runtime properties to automated tests.

Read how BDD in Action, Second Edition explains Testcontainers →

Kafka for Architects

Testcontainers is a library for running disposable containerized dependencies during automated tests.

How it is used
Runs disposable Dockerized Kafka clusters during automated integration tests.
How deep it goes
Explains runtime startup, producer and consumer validation, and infrastructure trade-offs without detailing implementation code.
Examples
Uses ProfileService producer and Customer360Service consumer tests against a Dockerized Kafka cluster.
What you can do after
Apply it via Testcontainers and Docker to validate Kafka behavior through real network, protocol, and persistence paths.

Read how Kafka for Architects explains Testcontainers →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.