Test like a ninja with Go
summary
Covers concrete Go techniques: table-driven and subtests for units, mockery + testify.mock for generated mocks, benchmarks run with go test -bench=. -benchmem and are machine-dependent, and fuzzing (added in Go 1.18) using the seed corpus and -fuzz/-fuzztime to discover edge cases. Recommends reproducing bugs with an integration test first, then fixing code; prefers many integration tests over heavy mocking and uses testcontainers-go to spin up databases reliably. Notes a quick survey: ~58% of developers write automated tests.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:51Why testing matters
- 4:44Go testing basics
- 7:55Unit test techniques
- 10:28Mocking dependencies
- 13:36Benchmarking performance
- 15:46Fuzz testing
- 19:16Example tests
- 20:43Integration tests
- 23:34Test suites with testify
- 25:44Test containers
- 27:35Resources and thanks
- 27:58Q&A








