gotest.toolsgotest.tools/testsum Index | Files | Directories

package testsum

import "gotest.tools/testsum"

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

Types

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

scan.go

Directories

PathSynopsis
testsum/cmd
Version
v1.4.0 (latest)
Published
Mar 21, 2018
Platform
linux/amd64
Imports
7 packages
Last checked
2 weeks ago

Tools for package owners.