Hi everyone,
I’ve been working on a project called testcontainers-ocaml, which brings Testcontainers style integration testing to OCaml.
The idea is simple:
Instead of mocking infrastructure (Postgres, Redis, Kafka, etc.), start real Docker containers inside your test suite and tear them down automatically.
Why?
In many OCaml projects, integration tests either:
-
Rely on mocks
-
Depend on globally running services
-
Or are skipped entirely in CI
Mocks are useful, but they don’t catch issues like:
-
Schema mismatches
-
Connection pool behavior
-
Real networking failures
-
Startup timing problems
-
Migration issues
Spinning up disposable containers per test gives us:
-
Isolated test environments
-
No shared global state
-
CI reproducibility
-
Real infrastructure behavior
Current Status
The project is currently incubating under the Docker organization.
I’m still actively shaping the API and would really appreciate feedback from the OCaml community on:
-
API ergonomics
-
Prebuilt modules (Postgres, Redis, etc.)
-
Testing best practices in OCaml
If anyone here has experience with integration testing patterns in OCaml, I’d love to hear thoughts.
Thanks!