Version: v1.4.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 7 Imported by: 0



Package testsum is DEPRECATED.

This functionality is now available from `go tool test2json` in the stdlib.

Package testsum provides functions for parsing `go test -v` output and returning a summary of the test run.

Build the executable:

go build -o gotestsum ./testsum/cmd


go test -v ./... | gotestsum

Example output:

=== RUN   TestPass
--- PASS: TestPass (0.00s)
=== RUN   TestSkip
--- SKIP: TestSkip (0.00s)
=== RUN   TestFail
Some test output
--- FAIL: TestFail (0.00s)
        example_test.go:22: some log output
exit status 1
FAIL    example.com/gotestyourself/testpkg        0.002s
======== 3 tests, 1 skipped, 1 failed in 2.28 seconds ========
--- FAIL: TestFail
Some test output

        example_test.go:22: some log output



This section is empty.


This section is empty.


This section is empty.


type Failure

type Failure struct {
	// contains filtered or unexported fields

Failure test including output

func (Failure) String

func (f Failure) String() string

type Summary

type Summary struct {
	Total    int
	Skipped  int
	Elapsed  time.Duration
	Failures []Failure

Summary information from a `go test -v` run. Includes counts of tests and a list of failed tests with the test output

func Scan

func Scan(in io.Reader, out io.Writer) (*Summary, error)

Scan reads lines from the reader, echos them to the writer, and parses the lines for `go test -v` output. It returns a summary of the test run.

func (*Summary) FormatFailures

func (s *Summary) FormatFailures() string

FormatFailures returns a string with all the test failure and the test output. Returns a empty string if there are no failures.

func (*Summary) FormatLine

func (s *Summary) FormatLine() string

FormatLine returns a line with counts of tests, skipped, and failed

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL