Skip to Content
View all events

Integration Testing with Docker and Testcontainers

Published by O'Reilly Media, Inc.

Intermediate content levelIntermediate

Reproducible test automation with Java ![New Online Training](https://cdn.oreillystatic.com/images/live-online-training/new-tag.svg "New Online Training")

The process of developing an application typically involves the work of multiple engineers, and that work is usually broken down into several modules. There is always a risk that modules developed by different engineers will not sync when integrating with each other for use in production. Integration testing helps minimize this risk by enabling better integration of modules. But many organizations struggle with maintaining tests that require more complex setup procedures. As a result, integration tests become flaky and unreliable and require manual intervention. In an automate-all-the-things world, this costs organizations time and money.

Join expert Benjamin Muschko to discover how to set up and run integration and functional tests with the help of the open source library Testcontainers. You will learn how to stand up lightweight, disposable Docker instances running your application as reliable test fixtures.

What you’ll learn and how you can apply it

By the end of this live online course, you’ll understand:

  • The purpose, differences, and trade-offs between test types
  • How to use Testcontainers to write integration tests

And you’ll be able to:

  • Write integration tests for different scenarios
  • Automate test execution in Maven and Gradle builds

This live event is for you because...

  • You’re a developer who wants to create more complex test scenarios.
  • You work to integrate automated test execution into your CI pipeline.
  • You’re a test engineer tasked with automating your testing in Docker.

Prerequisites

  • A computer with Java 11 OpenJDK and Docker Engine installed
  • A GitHub account
  • A Docker Hub account
  • A basic understanding of Docker and the Java programming language
  • Hands-on experience with common Java frameworks and dependencies
  • Experience with writing test code with the test framework JUnit 4 or JUnit 5

Recommended preparation:

  • Read “Build and Deployment Scripting” (chapter 6 in Continuous Delivery: Reliable Software Releases Through Build, Test, and Deployment Automation)

Recommended follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Problems with integration testing and how Testcontainers can help (60 minutes)

  • Presentation: The testing pyramid; What is Testcontainers?; Testcontainers technical quickstart
  • Group discussion: Your typical problems with integration testing
  • Exercise: Use Testcontainers for a Java-based project with JUnit 5
  • Q&A
  • Break

Implementing typical integration test scenarios (70 minutes)

  • Presentation: Testing database services; testing multiple services together with Docker Compose; building a container on the fly
  • Hands-on exercises: Use a database module; use the Docker Compose module; use the generic container module
  • Q&A
  • Break

Going further (45 minutes)

  • Presentation: Comparing Testcontainers with JUnit 4, JUnit 5, and Spock; using Testcontainers with different Java frameworks; Testcontainers on continuous integration; Testcontainers for languages other than Java
  • Hands-on exercise: Use Testcontainers on GitHub Actions

Wrap-up and Q&A (5 minutes)

Your Instructor

Benjamin Muschko

Benjamin Muschko is a software engineer, consultant, and trainer with more than 20 years of experience in the industry. He specializes in cloud-native application development and transformation, container solutions, DevSecOps, and Continuous Integration/Continuous Delivery implementations. Ben is an author, a frequent speaker at conferences, and an avid open source advocate.

linkedinXlinksearch

Skill covered

QA / Testing