A collection of packages to augment testing and support common patterns.

GoDoc CircleCI Go Reportcard


With Go modules enabled (go1.11+)

$ go get
import ""

To use with an older version of Go that does not understand Go module paths pin to version v2.3.0.


  • assert - compare values and fail the test when a comparison fails
  • env - test code which uses environment variables
  • fs - create temporary files and compare a filesystem tree to an expected value
  • golden - compare large multi-line strings against values frozen in golden files
  • icmd - execute binaries and test the output
  • poll - test asynchronous code by polling until a desired state is reached
  • skip - skip a test and print the source code of the condition used to skip the test



Expand ▾ Collapse ▴



Package gotesttools is a collection of packages to augment `testing` and support common patterns.

Source Files


Path Synopsis
assert Package assert provides assertions for comparing expected values to actual values.
assert/cmd/gty-migrate-from-testify Command gty-migrate-from-testify migrates packages from testify/assert and testify/require to
assert/cmp Package cmp provides Comparisons for Assert and Check
assert/opt Package opt provides common go-cmp.Options for use with assert.DeepEqual.
env Package env provides functions to test code that read environment variables or the current working directory.
fs Package fs provides tools for creating temporary files, and testing the contents and structure of a directory.
golden Package golden provides tools for comparing large mutli-line strings.
icmd Package icmd executes binaries and provides convenient assertions for testing the results.
internal/cleanup Package cleanup handles migration to and support for the Go 1.14+ testing.TB.Cleanup() function.
internal/difflib Package difflib is a partial port of Python difflib module.
poll Package poll provides tools for testing asynchronous code.
skip Package skip provides functions for skipping a test and printing the source code of the condition used to skip the test.
x Package x is a namespace for experimental packages.
x/subtest Package subtest provides a TestContext to subtests which handles cleanup, and provides a testing.TB, and context.Context.