Spring I/O

Sessions

Sergei Egorov

TestContainers - testing with Docker

Sergei Egorov - Uvita GmbH

Unit testing is fine, but without a proper integration testing, especially if you work with external resources like databases and other services, you might not know how your application will behave once it has been deployed to the real environment.

Before the 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, now we can quickly prepare the environment with Docker for our tests.

In this workshop I 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 Spring Boot micro-service and use real MySQL, Redis and Kafka to test it, will isolate it from other micro-services, then start Selenium browsers in Docker and test our website, 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!.

Prerequisites:
General experience in using the following technologies is expected. Participants can tag along if they don’t know all the details, but some topics might get too complex if they are missing the basics.

- Java
- Docker basics
- JUnit 4
- Spring-Boot basics are helpful

As this is a hands-on workshop, it is essential that you bring a prepared workstation, containing the following software:

- JDK 8 - Docker 18-CE

We can guarantee that it will work on the following environments:

- Any Linux
- macOS with Docker for Mac
- Windows 10 with Docker for Windows
Of course, it is also possible to pair using one workstation.