Super excited to join the @Docker Captains Program 🎉 Honored to see my work on Testcontainers for .NET (and soon Docker.DotNet) being recognized. Looking forward to contributing to Docker, .NET, and open-source projects with the amazing folks in the program :tc-love:
No - you aren't doing "integration" testing with an in-memory database.
At best it's a glorified unit test...
I've seen many examples using the EF Core in-memory provider.
This isn't an integration test because there's no real database.
Worse, this will fail to catch any LINQ or SQL bugs.
Here's a better approach:
- Use a real database or Docker container
- Connect to this database from your tests
- Write proper integration tests that have value
If you want to use Docker, I recommend exploring Testcontainers.
It lets you define throwaway containers in your tests.
What tools or methods do you use for integration testing?
Been leaning hard on Docker Sandboxes lately to keep secrets out of my agent environment, no tokens sitting in env vars waiting to leak 🔒.
Put together a spec.yaml workflow that auths against GHE Copilot a private NuGet feed: github.com/HofmeisterAn/dock….
Testcontainers for .NET 4.12.0 is out 🐳 This release ships a major version bump of our forked Docker.DotNet client, bringing a bunch of improvements made over the past months. Fingers crossed it's all smooth sailing for you 🤞: github.com/testcontainers/te….
Along with many stability and performance improvements, the new Docker.DotNet version is now AOT-compatible. Check out the release notes from version 4.0.0 onward. They include many great updates: github.com/testcontainers/Do….
Testcontainers is hands down the best way to write integration tests in .NET.
You can run your external services in Docker containers, which you can access from your tests.
Here's how to spin up SQL Server in a container. 👇
The new Testcontainers for .NET release has arrived: github.com/testcontainers/te…. Version 4.11 comes with new modules, bug fixes, and improvements, plus OpenSSF Scorecard analyses for extra trustworthiness.
I've also got an update ready for the Docker.DotNet client, which in the next release will bring performance improvements, better resource usage, lots of fixes, and support for .NET's native HTTP handler 💪.
Here's what my integration tests look like with Testcontainers. 👇
Each test creates a command/query and sends it using MediatR.
Under the hood, there's an actual database running in a Docker container. This is powered by Testconatiners.
I've put together a few slides for future Testcontainers for .NET talks. If you're interested in discussing Testcontainers, let me know. Feedback on the slides is welcome as well: andrehofmeister.com/en/testc….
I never expected such an amazing journey when I started working on Testcontainers for .NET years ago. I've met many great people and learned a lot. I'm truly grateful for all of it. I never imagined the packages would one day pass 150M downloads!
Docker.DotNet is now compatible with the latest Docker Engine v29 (github.com/testcontainers/Do…). Please note that backward compatibility with earlier API versions is limited due to the project's current structure.
A new Testcontainers for .NET release is available. This release supports .NET 10 and ensures compatibility with Docker Engine v29: github.com/testcontainers/te…. I'm working on updating Docker.DotNet for full v29 support, so expect a new version soon /cc @Docker.
Check out the new available modules like Playwright, Grafana, or my favorite this release, Toxiproxy. It's a really interesting tool for pushing testing further: dotnet.testcontainers.org/mo….
Heads up, .NET devs: If your client-side Blazor WASM app fails (in Rider) with 'Failed to establish connection to debugger agent' but works in a regular browser, check your debug type, mine was accidentally set to embedded.
If you're updating to Docker Engine v29 and using Docker.DotNet, make sure to pin the API version to 1.44 (or similar). v29 breaks the library. More details here: github.com/moby/moby/release….