Table-driven tests
Use table-driven tests when cases share setup and assertions. Addt.Run so each case is reported by name.
Naming
Name test functionsTest<Type>_<Behavior> or Test<Function>_<Scenario>. Name table cases so failures read like a sentence.
Parallel execution
Uset.Parallel() only when tests do not share mutable state or external resources.
Helpers and cleanup
Helpers that assert must callt.Helper(). Use t.Cleanup() for resource cleanup so subtests complete before cleanup runs.
Test data
Inline small fixtures. Usetestdata/ for larger files and include them in Bazel targets.
Time-dependent logic
Usepkg/clock to control time rather than sleeping.
