# Testcontainers

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Repository: https://github.com/testcontainers/testcontainers-java
Canonical: https://ross.abutalabs.com/products/testcontainers
Homepage: https://testcontainers.org
Language: Java
License: MIT
License Family: permissive
Topics: java, docker, docker-compose, junit, test-automation, jvm, testing, hacktoberfest, integration-testing
Last push: 2026-08-26T20:55:52+00:00
Link (homepage): https://testcontainers.org
Link (site_page): https://testcontainers.com/guides/getting-started-with-testcontainers-for-dotnet
Link (site_page): https://testcontainers.com/guides/getting-started-with-testcontainers-for-nodejs
Link (site_page): https://testcontainers.com/getting-started
Link (site_page): https://testcontainers.com/guides/getting-started-with-testcontainers-for-java

## Health v2 (maintenance only)
Score: 93/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 80, longevity 100
- inputs: {"age_days": 4161, "days_push": 7, "days_rel": 135, "gap_med": 28, "n_releases_24m": 16}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8720, forks 1914 (observed 2026-08-28T04:10:24.432715+00:00)

## What it is
Testcontainers is a family of libraries (Java, Go, .NET, Rust, and more) that provides lightweight, throwaway Docker containers for use in tests, such as databases, message brokers, and Selenium browsers. It lets developers define test dependencies as code and run reliable integration tests against real services instead of mocks or in-memory fakes.

## Use cases
- spin up a throwaway postgres database for integration tests
- run integration tests against real services instead of mocks
- test database interactions in junit with docker containers
- bootstrap selenium web browsers for automated browser tests
- provision message brokers like redis or kafka for local testing
- make ci test pipelines deterministic with isolated dependencies

## When to choose
- you need integration tests against real databases, brokers, or browsers
- you want deterministic, isolated test environments without shared state
- you're tired of maintaining mocks or in-memory substitutes that diverge from production
- you work in java, go, .net, python, node.js, or rust and have docker available

## When to avoid
- your environment cannot run docker (e.g., restricted CI or no daemon)
- you only need fast unit tests with no external dependencies
- container startup overhead is unacceptable for your test suite latency
- you need to test against managed cloud services rather than local containers

## Facets
- artifact type: library
- maturity: stable
- function: testing, e2e-testing, container-runtime, developer-tools
- domain: testing, developer-tools, databases
- platform: jvm, go, dotnet, python, rust, cross-platform
- tags: integration-testing, docker-containers, junit, test-dependencies, throwaway-instances, selenium, message-brokers, containers, devops, nodejs, docker

## Member repositories
- testcontainers/testcontainers-java (main) score 93
- testcontainers/testcontainers-go (sdk) score 94
- testcontainers/testcontainers-dotnet (sdk) score 95
- testcontainers/testcontainers-rs (sdk) score 98

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:24.432715+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:25:20.248231+00:00, confidence not recorded.
  - readme: https://github.com/testcontainers/testcontainers-java (fetched 2026-08-28T04:10:24.432715+00:00, sha aad5dd088f9e)
  - homepage: https://testcontainers.org (fetched 2026-08-29T08:25:50.379119+00:00, sha 18acadcdfe93)
  - site_page: https://testcontainers.com/guides/getting-started-with-testcontainers-for-dotnet (fetched 2026-08-29T08:25:50.398898+00:00, sha cb0404881f62)
  - site_page: https://testcontainers.com/guides/getting-started-with-testcontainers-for-nodejs (fetched 2026-08-29T08:25:50.401632+00:00, sha b5585c2d107d)
  - site_page: https://testcontainers.com/getting-started (fetched 2026-08-29T08:25:50.389672+00:00, sha 5d1bff396e32)
  - site_page: https://testcontainers.com/guides/getting-started-with-testcontainers-for-java (fetched 2026-08-29T08:25:50.392774+00:00, sha 5ed6e2fb39fd)
  - site_page: https://testcontainers.com/guides/getting-started-with-testcontainers-for-go (fetched 2026-08-29T08:25:50.395741+00:00, sha 04b5ff0e4bfc)
- Data as of 2026-08-30T08:39:29.467469+00:00.
