liveBook · Manning

Testing package

The testing package is Go’s standard-library package for defining, running, and reporting automated tests and benchmarks.

How 2 Manning books explain it

Go in Practice, Second Edition

The Go testing package is a standard-library package for defining and running automated tests and reporting test failures.

How it is used
Defines and runs automated package tests while reporting failures and measuring coverage.
How deep it goes
Demonstrates test-file naming, Test functions, failure output, package commands, and coverage, but not advanced test organization.
Examples
Uses a reverse-name function, TestName, Unicode input, failure diagnostics, rune conversion, and coverage output.
What you can do after
Diagnose/debug implementation defects with Test functions, go test output, assertions, and coverage reports.

Read how Go in Practice, Second Edition explains testing package →

Learn Go with Pocket-Sized Projects

The Go testing package provides support for automated tests, benchmarks, and related test execution features.

How it is used
Provides standard-library tools for writing, executing, and organizing Go tests, examples, and benchmarks.
How deep it goes
Explains test signatures, four execution phases, scenario naming, table-driven cases, and output checks without covering testing internals.
Examples
Demonstrates greet tests for English, French, and unknown languages, using expected values, actual values, and t.Errorf.
What you can do after
Apply the testing package to write scenario tests, report failures, run go test, and structure multi-input checks.

Read how Learn Go with Pocket-Sized Projects explains testing package →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.