testcontainers-java :: index

Testcontainers

Testcontainers logo

About

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.

Testcontainers make the following kinds of tests easier:

Prerequisites

Maven dependencies

Testcontainers is distributed as separate JARs with a common version number:

For the core library, the latest Maven/Gradle dependency is as follows:

testCompile "org.testcontainers:testcontainers:{{latest_version}}"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>testcontainers</artifactId>
    <version>{{latest_version}}</version>
    <scope>test</scope>
</dependency>

You can also check the latest version available on Maven Central.

JitPack builds are available for pre-release versions.

!!! warning "Shaded dependencies" Testcontainers uses the docker-java client library, which in turn depends on JAX-RS, Jersey and Jackson libraries. These libraries in particular seem to be especially prone to conflicts with test code/application under test code. As such, these libraries are 'shaded' into the core testcontainers JAR and relocated under org.testcontainers.shaded to prevent class conflicts.

Who is using Testcontainers?

License

See LICENSE.

Attributions

This project includes a modified class (ScriptUtils) taken from the Spring JDBC project, adapted under the terms of the Apache license. Copyright for that class remains with the original authors.

This project was initially inspired by a gist by Moshe Eshel.

Copyright

Copyright (c) 2015-2019 Richard North and other authors.

See AUTHORS for contributors.