Disable Testcontainers JUnit 5 tests without Docker
Testcontainers simplifies testing against third-party components such as databases. But sometimes, you want to run your Junit 5 tests and skip those requiring Docker.
To run Testcontainers-based tests, you need a Docker-API compatible container runtime, such as using Testcontainers Cloud or installing Docker locally.
Luckily, Testcontainers Junit5 integration allows you to toggle these tests by annotating them with @Testcontainers(disabledWithoutDocker = true)
.
See an example of a commit in Micronaut Test.
Tags: #docker #testcontainers #junit