SlideShare a Scribd company logo
2
Most read
4
Most read
5
Most read
Introduction to TestContainers for Integration Testing
What is Testcontainers?
● Testcontainers is a library that can manage container life cycle during
tests
● It provides lightweight, throwaway instances of common databases,
cloud services, SFTP servers, message queues or anything else that
can run in a Docker container
Introduction to TestContainers for Integration Testing
When do we use Testcontainers?
When we want to test the interaction between the application with other external
components in a production-like environment:
● Data access layer integration tests: MySQL, PostgreSQL or Oracle database
○ For example, regression tests when we move to another database
● Application Integration Test: SFTP, message queues
● Cloud Service Integration Test: AWS stacks, Azure, GCP...
Advantages
● Easy to set up
● Containers Life Cycle auto-management
○ Wait for containers to start before executing the tests
● Clean up after tests done
○ Shut down containers after each test or reuse same containers for all tests
● No need to manage port
○ Each container is assigned a free port and can be programmatically retrieved
● No need to stop containers if tests are stopped abruptly
○ There is a heartbeat container that will kill running containers after JVM shutdowns
Introduction to TestContainers for Integration Testing
Advantages cont.
● Can work with any container image on Docker Hub or custom images
● Work with JUnit 5 and Spring Boot
● Work with Spock
● Work with Python, NodeJs and more is coming
○ https://github.com/testcontainers
Drawbacks
● Docker required
● Slower than Unit Tests
Questions
Demo
Conclusion
TestContainers is a good option to improve the quality of the applications and
gives us some confidence that the application will work and interact correctly with
different components in production-like environment.

More Related Content

Similar to Introduction to TestContainers for Integration Testing (20)

PDF
Scala, docker and testing, oh my! mario camou
J On The Beach
 
PDF
Docker in qa space
Nalini Kanth
 
PPTX
Run automated tests in Docker
Oleksandr Metelytsia
 
PDF
Testing AS A Container - Irfan Ahmad
Agile Testing Alliance
 
PDF
Testing containers with TestContainers @ AJUG 7/18/2017
Viktor Gamov
 
PDF
GeeCON Prague 2017 - TestContainers
Anton Arhipov
 
PDF
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
PPTX
Introduction to Docker - Getting Started with Docker
Aiyana Shukla
 
PDF
The pain and gains running Docker in live @Pipedrive
Renno Reinurm
 
PDF
Augmenting Software Development with Containerization in Automation Testing.pdf
kalichargn70th171
 
PDF
JavaOne 2017 - TestContainers: integration testing without the hassle
Anton Arhipov
 
PPTX
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
Daniel Bryant
 
PPTX
JBCN_Testing_With_Containers
Grace Jansen
 
PPTX
JLove - Replicating production on your laptop using the magic of containers
Grace Jansen
 
PDF
Using Docker for Testing - Mukta
Agile Testing Alliance
 
PDF
Using Docker for Testing
Mukta Aphale
 
PDF
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
PDF
JavaDay Kiev 2017 - Integration testing with TestContainers
Anton Arhipov
 
PDF
Integration tests: use the containers, Luke!
Roberto Franchini
 
PDF
Reaching Production Faster with Containers in Testing
C4Media
 
Scala, docker and testing, oh my! mario camou
J On The Beach
 
Docker in qa space
Nalini Kanth
 
Run automated tests in Docker
Oleksandr Metelytsia
 
Testing AS A Container - Irfan Ahmad
Agile Testing Alliance
 
Testing containers with TestContainers @ AJUG 7/18/2017
Viktor Gamov
 
GeeCON Prague 2017 - TestContainers
Anton Arhipov
 
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
Introduction to Docker - Getting Started with Docker
Aiyana Shukla
 
The pain and gains running Docker in live @Pipedrive
Renno Reinurm
 
Augmenting Software Development with Containerization in Automation Testing.pdf
kalichargn70th171
 
JavaOne 2017 - TestContainers: integration testing without the hassle
Anton Arhipov
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
Daniel Bryant
 
JBCN_Testing_With_Containers
Grace Jansen
 
JLove - Replicating production on your laptop using the magic of containers
Grace Jansen
 
Using Docker for Testing - Mukta
Agile Testing Alliance
 
Using Docker for Testing
Mukta Aphale
 
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
JavaDay Kiev 2017 - Integration testing with TestContainers
Anton Arhipov
 
Integration tests: use the containers, Luke!
Roberto Franchini
 
Reaching Production Faster with Containers in Testing
C4Media
 

Recently uploaded (20)

PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Digital Circuits, important subject in CS
contactparinay1
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Ad

Introduction to TestContainers for Integration Testing

  • 2. What is Testcontainers? ● Testcontainers is a library that can manage container life cycle during tests ● It provides lightweight, throwaway instances of common databases, cloud services, SFTP servers, message queues or anything else that can run in a Docker container
  • 4. When do we use Testcontainers? When we want to test the interaction between the application with other external components in a production-like environment: ● Data access layer integration tests: MySQL, PostgreSQL or Oracle database ○ For example, regression tests when we move to another database ● Application Integration Test: SFTP, message queues ● Cloud Service Integration Test: AWS stacks, Azure, GCP...
  • 5. Advantages ● Easy to set up ● Containers Life Cycle auto-management ○ Wait for containers to start before executing the tests ● Clean up after tests done ○ Shut down containers after each test or reuse same containers for all tests ● No need to manage port ○ Each container is assigned a free port and can be programmatically retrieved ● No need to stop containers if tests are stopped abruptly ○ There is a heartbeat container that will kill running containers after JVM shutdowns
  • 7. Advantages cont. ● Can work with any container image on Docker Hub or custom images ● Work with JUnit 5 and Spring Boot ● Work with Spock ● Work with Python, NodeJs and more is coming ○ https://github.com/testcontainers
  • 8. Drawbacks ● Docker required ● Slower than Unit Tests
  • 10. Demo
  • 11. Conclusion TestContainers is a good option to improve the quality of the applications and gives us some confidence that the application will work and interact correctly with different components in production-like environment.

Editor's Notes

  • #5: https://github.com/localstack/localstack https://www.testcontainers.org/modules/localstack/