Skip to content
masterclass Buddy

Go · Concept

Table-driven tests

A table-driven test stores many cases in a table and applies one test body to each case. Named subtests make individual failures easier to find.

Last updated

Since
Go 1.7

Syntax

t.Run(name string, f func(t *testing.T)) bool

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • testing.T.Run
  • testing.T.Errorf
  • testing.T.Fatal
  • -run
  • subtests

Source: Using Subtests and Sub-benchmarks. Checked 2026-11-03.