•
Process isolation
•
FileSystem, Network
•
CPU/memory limits
Slide 14
•
Con guring multiple services simultaneously
•
Flexibility in creating test data or use-cases
•
Separation of production & test environments
•
Dynamic con guration of external mappings
•
Parallel deployments fi
fi
😅
Testcontainers-java •
Created 7 years ago
•
github.com/testcontainers/testcontainers-java
•
Uses docker-java API
•
Integrates with frameworks, like Spring, JUnit
•
Automatic Docker environment discovery
•
Automatic cleanup
Slide 18
Replacing a hard problem with a hard solution is not success. Nor is replacing an easy problem with an easy solution.
Slide 19
System checks Checking the system… ✔ Docker version should be at least 1.6.0 ✔ Docker environment should have more than 2GB free disk space ✔ File should be mountable
ℹ︎
✔ A port exposed by a docker container should be accessible
Slide 20
During
After
Slide 21
The problem
Extra mile
Port conflicts
Port randomization
Hard-coded scenarios
Data-driven tests
Slow tests
Parallelization
Slide 22
We think it’s a useful default option for creating a reliable environment for running tests. … Our teams have consistently found this library of programmable, lightweight and disposable containers to make functional tests more reliable. https://www.thoughtworks.com/en-us/radar/languages-and-frameworks/testcontainers
Slide 23
Slide 24
Show me the code
Slide 25
Model: record Rating (String talkId, Integer value) {}