testsum

package
v1.4.0 Latest Latest
Warning

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

Documentation

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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