Skip to content

Couchbase Module

Testcontainers module for Couchbase. Couchbase is a document oriented NoSQL database.

Usage example

Running Couchbase as a stand-in in a test:

  1. Define a bucket:

    BucketDefinition bucketDefinition = new BucketDefinition("mybucket");
    
  2. define a container:

    CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_ENTERPRISE)
        .withBucket(bucketDefinition)
    
  3. create an cluster:

    Cluster cluster = Cluster.connect(
        container.getConnectionString(),
        container.getUsername(),
        container.getPassword()
    );
    

Adding this module to your project dependencies

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

testImplementation "org.testcontainers:couchbase:1.19.0"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>couchbase</artifactId>
    <version>1.19.0</version>
    <scope>test</scope>
</dependency>