Skip to content

Dynalite Module

Testcontainers module for Dynalite. Dynalite is a clone of DynamoDB, enabling local testing.

Usage example

Running Dynalite as a stand-in for DynamoDB in a test:

public class SomeTest {

    @Rule
    public DynaliteContainer dynamoDB = new DynaliteContainer();

    @Test
    public void someTestMethod() {
        // getClient() returns a preconfigured DynamoDB client that is connected to the
        //  dynalite container
        final AmazonDynamoDB client = dynamoDB.getClient();

        ... interact with client as if using DynamoDB normally

Why Dynalite for DynamoDB testing?

In part, because it's light and quick to run. Also, please see the reasons given by the author of Dynalite and the problems with Amazon's DynamoDB Local.

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:dynalite:1.20.2"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>dynalite</artifactId>
    <version>1.20.2</version>
    <scope>test</scope>
</dependency>

Hint

Adding this Testcontainers library JAR will not automatically add an AWS SDK JAR to your project. You should ensure that your project also has a suitable AWS SDK JAR as a dependency.