Back to godoc.org
gotest.tools / testsum

Package testsum

v1.4.0
Latest Go to latest

The latest major version is v3.

Published: Mar 21, 2018 | License: Apache-2.0 | Module: gotest.tools

Overview

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

Usage:

go test -v ./... | gotestsum

Example output:

=== RUN   TestPass
--- PASS: TestPass (0.00s)
=== RUN   TestSkip
--- SKIP: TestSkip (0.00s)
        example_test.go:11:
=== RUN   TestFail
Some test output
--- FAIL: TestFail (0.00s)
        example_test.go:22: some log output
FAIL
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

Index

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier