A Claude Code plugin bundling skills and agents that guide Claude to build Spring Boot 4.x / Java 21+ apps with best practices.
testcontainers/testcontainers-java
A Java library for JUnit tests that spins up disposable Docker containers for databases, Selenium browsers, and other services.
- Stars
- 8,759
- Forks
- 1,950
- Open issues
- 638
- Last commit
- 4 days ago
What is it?
Testcontainers lets Java tests run against real infrastructure instead of mocks. Tests start lightweight, throwaway Docker containers for databases, Selenium web browsers, or any other service that can run in a container, and the containers are discarded when the tests finish.
It integrates with JUnit, so container lifecycles are tied to test classes and methods. The project also provides pre-built modules for common databases and services, and the same approach works for any image you can run in Docker.
The library requires a working Docker environment, and its documentation is hosted at java.testcontainers.org.
Key features
- 01Starts disposable Docker containers for tests and tears them down afterward.
- 02Integrates with JUnit test lifecycles.
- 03Provides ready-made support for common databases and Selenium browsers.
- 04Works with any service that can run in a Docker container.
Use cases
- Running integration tests against a real database instead of an in-memory substitute.
- Testing browser-based UI flows with Selenium in a containerized environment.
- Spinning up message brokers or other dependencies needed by a Java service's test suite.
Quick start
- 1
Read the documentation for setup instructions
Things to know
- Requires a running Docker (or compatible container runtime) environment to execute tests.
In collections
Topics
FAQ
- What is testcontainers-java?
- A Java library for JUnit tests that spins up disposable Docker containers for databases, Selenium browsers, and other services. Testcontainers lets Java tests run against real infrastructure instead of mocks. Tests start lightweight, throwaway Docker containers for databases, Selenium web browsers, or any other service that can run in a container, and the containers are discarded when the tests finish.
- Is testcontainers-java free to use? What license does it have?
- testcontainers-java is open source under the MIT license. Check the license terms before using it in commercial products.
- Is testcontainers-java still maintained?
- Actively maintained. The last commit to testcontainers-java was on Nov 2, 2026.
- What can I use testcontainers-java for?
- Running integration tests against a real database instead of an in-memory substitute. Testing browser-based UI flows with Selenium in a containerized environment. Spinning up message brokers or other dependencies needed by a Java service's test suite.
- How do I install testcontainers-java?
- Read the documentation for setup instructions
- Where can I get testcontainers-java?
- The source code and installation instructions are on GitHub: https://github.com/testcontainers/testcontainers-java
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Open-source API and integration testing tool that records real traffic via eBPF and replays it as tests and data mocks, with no code changes.
A TAP-compliant automated testing framework for writing and running tests of Bash scripts and other UNIX programs.
Hurl is a command line tool that runs and tests HTTP requests written in a plain text file format.
A free Java code coverage library that measures which parts of Java bytecode are exercised by tests.
Playwright is a framework for web testing and automation that drives Chromium, Firefox, and WebKit through one API.