testcontainers/testcontainers-scala
55.1
Weak · 28 September 2026
3.7k
lines of production code
Scala
primary language
2
measurements over time
What this system is
This system is a Scala library that provides a DSL and integration traits for managing Docker Testcontainers within testing frameworks like ScalaTest, MUnit, and specs2. It enables developers to define, start, and stop containerized services—such as databases, message brokers, and cloud emulators—either for the entire test suite or on a per-test basis. The library handles container lifecycle management, port exposure, and cross-container dependencies while ensuring proper resource cleanup.
How it got here
2016–2019 — SBT migration and DSL redesign
23 changes.
The project migrated its build infrastructure from Gradle to SBT and overhauled its core architecture by introducing a new Container DSL and Def pattern for idiomatic Scala configuration. This period focused on replacing legacy lifecycle traits with comprehensive ScalaTest integration traits and expanding support for numerous database and service containers.
2020–2025 — test framework expansion and coverage
15 changes.
This period focused on expanding the test framework by adding integration modules for MUnit and specs2, alongside deprecating implicit string conversions for Docker images. Significant effort was also directed toward broadening test coverage across numerous container modules, including ClickHouse, Kafka, Cassandra, and various cloud emulators, while introducing automation for release notes generation.
Features
Add specs2 integration for Testcontainers
This change introduces a new integration module for the specs2 testing framework, allowing users to manage Testcontainers within specs2 specifications. It provides traits such as \TestContainersForAll\ and \TestContainersForEach\ to handle container lifecycle (start/stop) at the suite or test level, along with \TestContainerForAll\ and \TestContainerForEach\ for single-container scenarios. The implementation includes lifecycle hooks (\afterContainersStart\, \beforeContainersStop\) and a \withContainers\ helper for accessing started containers, ensuring proper cleanup even when tests fail or setup throws exceptions.
test-framework/specs2 · high confidence
Added Selenium test container support for ScalaTest
Introduced a new \SeleniumTestContainerSuite\ trait and \SeleniumContainer\ class in the \test-framework/scalatest-selenium\ module, enabling users to easily integrate Selenium WebDriver containers into their ScalaTest suites. This addition allows tests to automatically manage browser container lifecycles, providing access to WebDriver instances, VNC addresses, and recording modes for debugging.
test-framework/scalatest-selenium/src/main · high confidence
Added TestLifecycleAware trait for test lifecycle hooks
Users can now implement the new TestLifecycleAware trait to receive callbacks before and after individual tests run. This allows for custom setup or cleanup logic tied to specific test execution events via the beforeTest and afterTest methods.
core/src/main/scala/com/dimafeng/testcontainers/lifecycle · high confidence
Added automated release notes generation script
A new Scala-based CLI tool (\bin/generate-release.scala\) has been added to automate the creation of GitHub release notes. This script accepts start and end git tags along with a GitHub token, then aggregates commit counts, contributor lists, and merged pull requests to generate a formatted release body and publish it directly to the repository.
bin · high confidence
Introduce ScalaTest container lifecycle traits
Added three new Scala traits—ForAllTestContainer, ForEachTestContainer, and the base TestContainersSuite—to the test framework. ForAllTestContainer starts the container once before the first test and stops it after the last test in the suite, while ForEachTestContainer starts and stops the container for every individual test. The base suite trait provides the container definition and hooks for lifecycle events (afterStart, beforeStop, beforeTest, afterTest), including integration with TestLifecycleAware for per-test container notifications.
test-framework/scalatest/src/main/scala/com/dimafeng/testcontainers · high confidence
Introduce new container DSL with Def pattern and add numerous service modules
The library introduces a new container definition DSL (Def pattern) across core and module classes, allowing users to define containers via case classes with a createContainer method. This change adds support for Docker Compose v2, FixedHostPortGenericContainer with startup check strategies, and new container wrappers for Cassandra, ClickHouse, CockroachDB, Couchbase, Db2, Elasticsearch, InfluxDB, K3s, Kafka, Schema Registry, LocalStack, LocalStack V2, MariaDB, Milvus, MinIO, Bigtable, Firestore, and PubSub emulators. The new DSL provides a more idiomatic Scala API for configuring and instantiating test containers.
repository · high confidence
Introduction of new Container DSL and lazy container support
The library introduces a new Container DSL defined by the \ContainerDef\ trait, which separates container creation (\createContainer\) from lifecycle management (\start\). This is accompanied by a new \SingleContainer\ implementation that wraps the underlying Java testcontainers instance and exposes its properties (such as ports, environment variables, and logs) through Scala-friendly methods. Additionally, a \MultipleContainers\ class and \LazyContainer\ wrapper are added to support running multiple containers in a single test, with \LazyContainer\ specifically designed to handle cross-container dependencies where one container requires data (like a JDBC URL) from another only after it has started.
core/src/main/scala/com/dimafeng/testcontainers · high confidence
New MUnit integration with trait and fixture-based container lifecycles
This change introduces a new MUnit integration module in test-framework/munit, providing two distinct ways to manage Testcontainers in MUnit tests. First, it adds lifecycle traits (TestContainerForAll, TestContainerForEach, TestContainersForAll, TestContainersForEach) that allow users to mix container management directly into their test suites, supporting both single and multiple containers with start/stop hooks. Second, it adds a fixtures module (TestContainersFixtures) offering MUnit FunFixtures (ForEachContainerFixture, ForAllContainerFixture, ContainerFunFixture) for users who prefer the fixture pattern. The implementation includes comprehensive test coverage verifying container lifecycle methods (start, stop, beforeTest, afterTest) and edge cases like ignored tests or overridden lifecycle methods.
test-framework/munit · high confidence
New ScalaTest integration traits for container lifecycle management
The ScalaTest integration module introduces four new traits—TestContainerForAll, TestContainerForEach, TestContainersForAll, and TestContainersForEach—that allow users to define and manage Docker container lifecycles within test suites. These traits enable starting containers before all tests or before each test, supporting both single and multiple container scenarios via the \withContainers\ helper, and provide hooks for pre/post-start and pre/post-stop logic.
test-framework/scalatest/src/main/scala/com/dimafeng/testcontainers/scalatest · high confidence
Removals
Removal of legacy test container lifecycle traits and accessor
The \SeleniumTestContainer\, \TestContainer\ (including \ForEachTestContainer\ and \ForAllTestContainer\ traits), and \TestContainerAccessor\ have been removed from the library. This eliminates the previous mechanism for managing container lifecycles within ScalaTest suites, requiring users to adopt the current container management approach.
src/main · high confidence
Behavioural changes
Deprecation of implicit String to DockerImageName conversion
The implicit conversion allowing strings to be automatically passed to container constructors is now deprecated. Users should explicitly use \DockerImageName\ in their container constructors instead of relying on the implicit \stringToDockerImageName\ conversion, which will be removed in a future version.
core/src/main/scala/com/dimafeng/testcontainers/implicits · high confidence
Removal of Gradle wrapper configuration
The Gradle wrapper properties file has been deleted, removing the local configuration for the Gradle build tool wrapper (specifically version 2.5). This change eliminates the project's ability to bootstrap the Gradle build environment using the standard wrapper mechanism.
gradle · high confidence
Repository initialization with new documentation structure and SBT build tooling
The repository has been initialized with a comprehensive documentation structure, including a new README, CONTRIBUTING guide, and detailed scalacheck documentation. The build system has been migrated from Gradle to SBT, evidenced by the removal of Gradle wrapper scripts and the addition of an SBT-specific .gitignore and .jvmopts configuration. Additionally, standard project files such as the MIT LICENSE and a scalastyle configuration have been added to support the new development workflow.
(repo-wide) · high confidence
Test coverage
Added Java stub to work around Scala compiler issue; Added Oracle test container integration; Added integration test for Selenium container support; Added integration tests for Kafka and Cassandra containers; Added integration tests for ScalaTest container wrappers; Added test coverage for Bigtable, Firestore, and PubSub emulator containers; Added test coverage for TestContainer and TestContainers lifecycle behaviors; Added test coverage for container lifecycle and base spec; Added test coverage for container lifecycle and multiple container scenarios; Added test for ClickHouseContainer; Added test for PostgreSQL container startup; Added test for RabbitMQ container startup; Added test resource files for Docker-based test infrastructure; Added tests for K3sContainer startup and configuration; Added tests for LocalStackV2 container integration; Added tests for Qdrant container integration; Added tests for Toxiproxy container; Added tests for WireMock container wrapper; Added tests for YugabyteDB container support; Added unit tests for MockServer container; Migrate MySQL integration tests to ScalaTest 3 and update container configuration; Removed Selenium integration test; Removed legacy JUnit-based test suite for container lifecycle verification.
Dependencies
Initial SBT build configuration and dependency management
The project build system has been initialized with SBT version 1.11.0, replacing previous build tooling. This change introduces a centralized dependency management file (Dependencies.scala) that defines versions for core libraries including Testcontainers 2.0.5, ScalaTest 3.2.9, MUnit 1.1.1, and various database drivers (PostgreSQL 42.7.7, Oracle 21.18.0.0, etc.), alongside build plugins for CI release, PGP signing, and Scalastyle.
project · high confidence
Migration from Gradle to SBT build tool
The project has switched its build system from Gradle to SBT. The previous Gradle configuration files (build.gradle, gradle.properties, settings.gradle) have been removed and replaced with a new build.sbt. This change updates the build infrastructure, setting the default Scala version to 2.12.20 with cross-compilation support for 2.13.16 and 3.3.6, and configures publishing to the Central Portal.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 57 → 55 (-1.5)
- Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.
Lenses
- Code Health 98 → 98 (+0.0)
- Architecture 100 → 81 (-19.0)
- Maturity 45 → 45 (+0.0)
- Readiness 44 → 44 (+0.0)
- Security 81 → 81 (+0.0)
New (3)
- Documentation: no project overview (README.md)
- Documentation: no usage examples (README.md)
- Projects may be oversized for their cohesion
Changes since last survey
- 9 commits — 5 feature/other, 4 fixes
By area
- (repo) — 4 commits
- project/Dependencies.scala — 3 commits
- modules/gcloud — 1 commit
- test-framework/scalatest — 1 commit
Notable commits
- fix: Fix nginx welcome page assertion after image content change
- fix: Fix stale cloud-sdk image tag in gcloud emulator specs
- fix: Merge pull request #611 from testcontainers/fix/nginx-welcome-page-text
- fix: Merge pull request #612 from testcontainers/fix/bump-testcontainers-2.0.5
- change: Merge pull request #613 from scala-steward/update/kafka-schema-registry-client-8.0.8
- change: Merge pull request #614 from scala-steward/update/slf4j-simple-2.0.20
- change: Update kafka-schema-registry-client to 8.0.8
- change: Update slf4j-simple to 2.0.20
- change: Update testcontainers to 2.0.5
Architecture
- Containers 0 added · 0 removed · contexts 1 added · 0 removed · edges 0 added · 0 removed
Added bounded contexts (1)
- repository
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
testcontainers/testcontainers-scala was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 28 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit c9b5087d65c5a44de28fbdcf875588bfb586f234 — the exact code this score is about.
- Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-d46da229e3fd.