How to test Go code with a database?
summary
Shows how to test Go code that interacts with a database by reducing reliance on fragile mocks and making tests easier to maintain as the codebase evolves. Describes techniques and approaches in Go for improving flexibility of changes and strengthening test guarantees when database access is involved.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:09Mocking problems in Go
- 3:26Test database choice
- 6:34Test DB connection setup
- 8:02DB cleanup methods
- 13:04Cleanup methods compared
- 15:56Parallel test execution
- 17:41CI test organization
- 19:51PostgreSQL speed tips
- 23:06Summary of integration tests
- 24:56Implementation tips
- 26:46Code examples & resources
- 27:14Q&A
related talks
34mAdvanced Testing Techniques in Go
01h 32mTesting in Go: 101
35mTest like a ninja with Go
28mIntro to Test-Driven Development in Go
44mGo Testing By Example
37mBuilding Database Applications with Database/SQL
42mBuilt-In Testing in Go is More Than Just Passable
24mGo Write Tests using Pragmatic Best Practices
