Real SQL Server with Testcontainers: Container Lifecycle, Migrations and Cleanup Between Tests
Start the SQL Server container once per assembly, open a separate database per test class, build the schema with migrations rather than EnsureCreated, and clean up with Respawn before every test. We measure transaction rollback, a database per test and Respawn on a shared database with the same ten tests, and show that rollback silently does nothing without PreserveExecutionContext and what container reuse really costs.
14 Nov 2026
·
12 min
·
2