You never know how your application performs once deployed to the production. Sure, you have unit tests, and your test coverage is sky high. However, you might depend on external resources like databases, web services, and distributed caches. Moreover, without a proper integration testing, you cannot be confident about the stability of your production environment. A long time ago, long before the invention of Docker, configuring the environment for integration testing was incredibly complicated and tedious. Developers and Ops were using fake database
implementations, mocking servers, and all kinds of weird tricks to implement the environment without the real environment, but it was ugly, bulky, faulty and not cross-platform as well. Thanks to Docker, those days are long gone, now we can quickly prepare the environment with Docker for our tests.
In this talk, I would like to spread the word about awesome project TestContainers – an open source library that exposes API for JUnit tests. It provides lightweight, disposable instances of shared databases, distributed caches or grids, or anything else that can run in a Docker container, all securely and reliably downloaded from your Docker Hub.