Loading…
0+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes .
Testing in Go is idiomatic and built into the language — no JUnit equivalent needed. This module covers the testing package (TestXxx naming convention, t.Error vs t.Fatal, t.Helper for test utility functions), table-driven tests (the idiomatic Go pattern for testing multiple cases — the slice-of-struct approach, when to use subtests vs parallel tests), testify's assert and require packages (assert continues on failure, require stops — the practical difference), t.Run for subtests (isolated scope, parallel subtests with t.Parallel()), benchmarks (BenchmarkXxx, b.ResetTimer, how to read benchmark output), TestMain for setup/teardown of shared test infrastructure (database connections, test containers), and the -race flag in tests to catch data races automatically. The interview question Go interviewers always ask: 'walk me through how you'd test a Go HTTP handler' — this module provides the complete answer.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–0 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–0 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q0.