How easy is it to write and maintain integration tests when the system under test interacts with databases and message stores? It can be quite challenging. The lack of control over the setup of databases can increase the cost of integration testing. Sometimes we take the route of using an in-memory database instead of the one we employ in the production environment, making the tests less effective. With docker containers, you can simplify this to some extent by running the setup before invoking your tests. Imagine if you get to control the database environment right from within the test code. TestContainers bring in this convenience.
Testcontainers is a Java library that you can invoke from your test code. It provides lightweight, throwaway instances of common databases, web browsers(Selenium tests), or anything else that can run in a Docker container.

Outline/Structure of the Demonstration

  • From containers to Testcontainers (5 minutes)
  • Overview of TestContainers and what problem they address (5 minutes)
  • Demo of using TestContainers with JUnit (5 minutes)
  • Various configuration examples (5 minutes)
  • Demo of using TestContainers with Spock(5 minutes)
  • Demo non-database integrations (5 minutes)
  • Using docker-compose (5 minutes)
  • Design choices with container reuse/ container lifecycle and their implications (5 minutes)
  • Q&A (5 minutes)

Learning Outcome

  • How Testcontainers simplify developing and maintaining integration tests
  • A tool that you can start using right away

Target Audience

Developers, Testers, Leads, Architects

Prerequisites for Attendees

Experience of developing and maintaining integration tests or having worked with such a team

schedule Submitted 3 weeks ago

Public Feedback

comment Suggest improvements to the Speaker