Go testing package

Go's standard library package for writing tests, run by the go test command.

In more detail

It has no assertion library; tests compare values themselves and call t.Errorf or t.Fatalf on failure. A test is a function TestXxx(t *testing.T) in a _test.go file.

Examples

func TestDouble(t *testing.T) {}
In this course: It has no assertion library; tests compare values themselves and call t.Errorf or t.Fatalf on failure. Table-driven tests play the role of pytest's parametrize.

Related terms

Taught in

References