Micronaut Test Resources: How to extend AbstractTestContainersProvider class

349 views Asked by At

Micronaut documentation says:

For test resources which make use of Testcontainers, you may extend the base AbstractTestContainersProvider class.

My question is: how to add this class properly to the classpath of the test resources sourceset (I am using Gradle)

1

There are 1 answers

0
melix On BEST ANSWER

You will need to add the following dependencies to your build.gradle file:

dependencies {
    testResourcesImplementation platform("io.micronaut:micronaut-bom:3.6.1")
    testResourcesImplementation "io.micronaut.testresources:micronaut-test-resources-testcontainers"
}

(note that I'm importing the Micronaut BOM so that you don't have to specify the test resources version, but you could use it directly)