AlgoMaster Logo

Subtests (t.Run)

Last Updated: May 22, 2026

Medium Priority
7 min read

t.Run lets you nest tests inside a parent test so each case has its own name, its own pass/fail line, and its own scope. It pairs naturally with the table-driven pattern and unlocks a few features that flat tests can't reach: per-case filtering on the command line, per-case parallelism with t.Parallel, and deterministic cleanup with t.Cleanup.

Premium Content

Subscribe to unlock full access to this content and more premium articles.