Integration testing with Docker and Testcontainers
Unit testing is fine, but without proper integration testing, especially if you work with external resources like databases and other services, you might not know how your application will actually behave once it has been deployed to the real production environment. Before Docker, configuring the environment for integration testing was painful – people were using fake database implementations, mocking servers, usually it was not cross-platform as well. However, thanks to Docker, now we can quickly prepare the environment for our tests. In thisI would like to show how you can use Testcontainers ( https://github.com/testcontainers/testcontainers-java ) – a popular Java testing library that provides lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. We will integrate it into a Spring Boot microservice and use real PostgreSQL and Mongo databases to test it, will isolate it from other microservices, then start Selenium browsers in Docker and test our application, and all with the same library! Come and learn why Apache, Spring, ZeroTurnaround, JetBrains, Playtika, Zipkin and others already decided to use Testcontainers for their integration testing needs!