A talk Q&A sorts out where Aspire, Testcontainers and Dev Containers overlap: one orchestrates your local app, one gives tests throwaway dependencies, one standardizes your toolchain.
Key points
- Testcontainers is a test library: it starts your database or broker, waits for readiness, then disposes it.
- Aspire is an application model where the AppHost declares services and dependencies and handles discovery and telemetry.
- `Aspire.Hosting.Testing` lets an integration test start the whole AppHost and get an `HttpClient` for a project.
- Testcontainers suits a single repository or message handler; Aspire testing suits end-to-end runs of the modelled app.
- Dev Containers containerize your toolchain, not your app's dependencies, so they solve a different problem.
- Both Aspire resources and Testcontainers share the same container runtime, so they can coexist and even stack in one solution.
Real-world use
- a repository test that needs a real PostgreSQL instance without spinning up the whole distributed app
- an end-to-end integration test that starts the full AppHost and calls an API endpoint over `HttpClient`
- a new team member opening the Aspire solution in a Dev Container to get the right .NET SDK and tools on day one
- running Aspire and Testcontainers side by side inside a Dev Container that has access to a container runtime
This summary was generated by the agent from the original post on Bart Wullems (The Art of Simplicity). The full text and all rights belong to its author and publisher. Go to original