testparser

package
v0.0.0-...-2014efb Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testparser provides a parser for go test output

Index

Constants

This section is empty.

Variables

View Source
var (
	RegexTest     = regexp.MustCompile(`=== RUN (.+)`)
	RegexStatus   = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`)
	RegexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`)
	RegexResult   = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`)
	RegexOuput    = regexp.MustCompile(`(    )*\t(.*)`)
	RegexSummary  = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`)
	RegexFail     = regexp.MustCompile(`(.*\w+.go)*:(\d+):(\d+):(.*\w+)`)
)

Regular Expressions for various parts of the go test output

Functions

This section is empty.

Types

type FailLine

type FailLine struct {
	File    string `json:"filename"`
	Row     int    `json:"row"`
	Column  int    `json:"column"`
	Message string `json:"message"`
}

func (*FailLine) String

func (fl *FailLine) String() string

type PackageResult

type PackageResult struct {
	Name     string        `json:"name"`
	Status   Status        `json:"status"`
	Duration time.Duration `json:"duration"`
	Coverage float32       `json:"coverage"`
	Summary  string        `json:"summary"`
	Tests    []*Test       `json:"tests"`
	Errors   []*FailLine   `json:"errors"`
}

func Parse

func Parse(r io.Reader) ([]*PackageResult, error)

Parse ...

type Status

type Status int
const (
	StatusFail Status = iota
	StatusPass
	StatusSkip
)

func (*Status) MarshalJSON

func (s *Status) MarshalJSON() ([]byte, error)

func (Status) String

func (s Status) String() string

type Test

type Test struct {
	Name     string        `json:"name"`
	Status   Status        `json:"status"`
	Duration time.Duration `json:"duration"`
	Output   []string      `json:"output"`
}

Jump to

Keyboard shortcuts

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