Rethinking Container-Based Service Tests: A Cautionary Tale
Unit tests with mocking external deps are more efficient than service tests with Testcontainers, allowing devs to deploy branches quickly & reducing testing/troubleshooting issues.
I've been working with Testcontainers for over 3 years in my day job. Initially I bought into the idea - being able to run service tests locally, with realistic mocks for your external dependencies. But I've changed my opinion. The main problem is that they require a fair amount of setup and maintenance. Plenty of code will be written, so you need to figure out the right pattern for scaling it. You'll encounter issues with image downloads (there are some beefy images out there), or container instantiation. Especially if you have machines with multiple OSes, or if you run these tests in your C...