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 2 months ago

Public Feedback

comment Suggest improvements to the Speaker
  • Aino Corry
    By Aino Corry  ~  2 weeks ago
    reply Reply

    Hi Naresha, thank you for your submission. 

    Will you also be talking about the drawbacks of TestContainers?

    • Naresha K .
      By Naresha K .  ~  2 weeks ago
      reply Reply

      Hi Aino,

      I will touch upon the trade-offs such as container reuse, resource utilisation along with the examples. In my observation, the negative impacts are due to using the tool as a golden hammer - for example, with the availability of TestContainers, teams not writing unit tests and expecting faster feedback from integration tests. Please let me know if you had any specific aspect in your mind when you mentioned drawbacks.