Advanced Testing Techniques in Go
summary
Argues that Go tests succeed when code is structured for DI and small internal interfaces, showing examples: swapping Redis and Memcache by implementing a Store interface, replacing Kafka/NSQ with a distilled consumer/producer API to avoid interface pollution, and injecting time via functions rather than globals. Recommends avoiding exported channels in public APIs, prefers synchronous methods, and demonstrates HTTP testing with httptest.NewRecorder and table-driven tests plus stateful flows using a cookie jar and real databases bootstrapped via docker-entrypoint-initdb.d.
AI-written summary · about
chapters (9)
- 0:00Why testing matters
- 2:51Structuring code for tests
- 7:50Dependency injection in Go
- 9:36Testing channels in Go
- 13:08Interfaces and testing
- 18:30Testing strategy approach
- 22:55HTTP testing techniques
- 27:15Docker for database tests
- 30:32Testing as communication








