subtest

A named test run inside another test, with its own pass or fail result, often one per case in a table of inputs.

In more detail

Go creates one with t.Run and Node's built-in test runner with t.test(). Each subtest reports separately, so a failure names the exact case, and a failing subtest marks its parent test as failed too. In Go, go test -run with a pattern can run one subtest on its own.

Example

t.Run(tc.name, func(t *testing.T) {})

Related terms

Taught in

References