October 2015
Beginner to intermediate
400 pages
14h 44m
English
go test Tool
The go test subcommand is a test driver for Go packages that are organized
according to certain conventions. In a package directory, files whose
names end with _test.go are not part of the package ordinarily built
by go build but are a part of it when built by go test.
Within *_test.go files, three kinds of functions are treated
specially: tests, benchmarks, and examples. A test function, which is a
function whose name begins with Test, exercises some program logic
for correct behavior; go test calls the test function and reports
the result, which is either
PASS or FAIL. A benchmark function has a name beginning with Benchmark and
measures the performance of some operation; go test reports the mean execution time ...