Documentation ¶
Overview ¶
Package lib is exposing parsers and output generation
Index ¶
Constants ¶
const ( // XUnitTemplate is XML template for xunit style reporting XUnitTemplate string = `` /* 526-byte string literal not displayed */ // XMLMultiTemplate is template when we have multiple suites XMLMultiTemplate string = ` <testsuites>` + XUnitTemplate + `</testsuites> ` // XUnitNetTemplate is XML template for xunit.net // see https://xunit.codeplex.com/wikipage?title=XmlFormat XUnitNetTemplate string = `` /* 1103-byte string literal not displayed */ )
Variables ¶
var Options struct { // FailOnRace will mark test a failed if there is a race FailOnRace bool }
Options is library options
Functions ¶
Types ¶
type GotestLexer ¶ added in v1.4.3
type GotestLexer struct {
// contains filtered or unexported fields
}
GotestLexer is a lexer for gotest output
func (*GotestLexer) Err ¶ added in v1.4.3
func (lex *GotestLexer) Err() error
Err returns the current error (if any)
func (*GotestLexer) Scan ¶ added in v1.4.3
func (lex *GotestLexer) Scan() bool
Scan scans the next token. Return true if there's a new one
func (*GotestLexer) Token ¶ added in v1.4.3
func (lex *GotestLexer) Token() *Token
Token returns the current Token
type GtParser ¶ added in v1.4.3
type GtParser struct {
// contains filtered or unexported fields
}
GtParser is a gotest output parser
type Lexer ¶ added in v1.4.3
Lexer generates tokens
func NewGotestLexer ¶ added in v1.4.3
NewGotestLexer returns a new lexer for gotest files
type LineScanner ¶
LineScanner scans lines and keep track of line numbers
func NewLineScanner ¶
func NewLineScanner(r io.Reader) *LineScanner
NewLineScanner creates a new line scanner from r
func (*LineScanner) Err ¶ added in v1.4.5
func (ls *LineScanner) Err() error
Err returns the current error (nil if no error)
func (*LineScanner) Text ¶ added in v1.4.5
func (ls *LineScanner) Text() string
Text returns the current line
type Parser ¶ added in v1.4.3
Parser generates suites
func NewGtParser ¶ added in v1.4.3
NewGtParser return a new gotest parser
type Status ¶
type Status int
Status is test status
func Token2Status ¶
Token2Status return matching status for token
type Suite ¶
Suite of tests (found in some unit testing frameworks)
func (*Suite) NumSkipped ¶
NumSkipped return number of skipped tests in suite
type SuiteStack ¶
type SuiteStack struct {
// contains filtered or unexported fields
}
SuiteStack is a stack of test suites
func (*SuiteStack) Pop ¶
func (s *SuiteStack) Pop() *Suite
Pop removes and returns a node from the stack in last to first order.
type Suites ¶
type Suites []*Suite
Suites is a list of suites
func ParseGocheck ¶
ParseGocheck parses output of "go test -gocheck.vv", returns a list of tests See data/gocheck.out for an example TODO: Refactor to shorter ones
func ParseGotest ¶
ParseGotest parser output of gotest TODO: Make it shorter
func (Suites) HasFailures ¶
HasFailures return true is there's at least one failing suite
type Test ¶
type Test struct {
Name, Time, Message string
Status Status
AppendedErrorOutput bool
// contains filtered or unexported fields
}
Test data structure
type TestResults ¶
type TestResults struct { Suites []*Suite Assembly string RunDate string RunTime string Time string Len int NumPassed int NumFailed int NumSkipped int Skipped Status Passed Status Failed Status }
TestResults is passed to XML template