Adding Testcontainers to the application
We have seen that, with mocking, we can replace a real service with a fake one. But what happens when you need to verify a real service, which involves talking to a real database?
The fact that each database engine has slight variations in implementations of SQL demands that we test our database operations against the same version we intend to use in production!
With the emergence of Docker in 2013 and the rise of putting various tools and applications inside containers, it has become possible to find a container for the database we seek.
Further cultivated by open source, just about every database we can find has a containerized version.
While this makes it possible for us to spin up an instance on our local workstation, the task of manually launching a local database every time we want to run our tests doesn’t quite cut it.
Enter Testcontainers. With their first release coming out in 2015, Testcontainers provides a mechanism...