~/talk

Testcontainers best practices.

Talkat Java ON 2024 · 2024-11-12..11-14· [testing]
links:none on file
slides:none on file

Testcontainers runs real services in on‑demand Docker containers so tests use the same versions as production; the talk shows Java code that starts PostgreSQL and Redis containers, uses Testcontainers modules (PostgreSQLModule, KafkaModule) instead of GenericContainer, and measures speed improvements (examples: sleeps drop tests from ~8s to ~2s when replaced by use wait strategies). Advice includes avoid static host and port, don't hardcode container names, pin explicit image versions (not latest), and prefer class‑ or suite‑level container lifecycles to reuse a single container.

AI-written summary · about

  1. 0:00Introduction
  2. 1:51What are Testcontainers
  3. 8:33Transforming integration testing
  4. 12:36Avoid host/port hardcoding
  5. 16:45Never hardcode container names
  6. 19:40Replace sleep with waits
  7. 24:20Use Testcontainers modules
  8. 31:07Avoid latest tag
  9. 34:46Optimize container lifecycle
  10. 45:06Spring Boot integration
  11. 55:32Summary
  12. 58:10Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.