junit

package
v0.0.173 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Overview

Package junit describes the test-infra definition of "junit", and provides utilities to parse it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Errored added in v0.0.122

type Errored struct {
	Message string `xml:"message,attr"`
	Type    string `xml:"type,attr"`
	Value   string `xml:",chardata"`
}

Errored holds <error/> elements.

type Failure added in v0.0.122

type Failure struct {
	Message string `xml:"message,attr"`
	Type    string `xml:"type,attr"`
	Value   string `xml:",chardata"`
}

Failure holds <failure/> elements.

type Properties

type Properties struct {
	PropertyList []Property `xml:"property"`
}

Properties defines the xml element that stores the list of properties that are associated with one benchmark.

type Property

type Property struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

Property defines the xml element that stores additional metrics about each benchmark.

type Result

type Result struct {
	Name       string      `xml:"name,attr"`
	Time       float64     `xml:"time,attr"`
	ClassName  string      `xml:"classname,attr"`
	Output     *string     `xml:"system-out,omitempty"`
	Error      *string     `xml:"system-err,omitempty"`
	Errored    *Errored    `xml:"error,omitempty"`
	Failure    *Failure    `xml:"failure,omitempty"`
	Skipped    *Skipped    `xml:"skipped,omitempty"`
	Status     string      `xml:"status,attr"`
	Properties *Properties `xml:"properties,omitempty"`
}

Result holds <testcase/> results

func (Result) Message

func (r Result) Message(max int) string

Message extracts the message for the junit test case.

Will use the first non-empty <error/>, <failure/>, <skipped/>, <system-err/>, <system-out/> value.

func (*Result) SetProperty

func (r *Result) SetProperty(name, value string)

SetProperty adds the specified property to the Result or replaces the existing value if a property with that name already exists.

func (Result) Truncate added in v0.0.34

func (r Result) Truncate(max int)

Truncate ensures that strings do not exceed the specified length.

type Skipped added in v0.0.122

type Skipped struct {
	Message string `xml:"message,attr"`
	Value   string `xml:",chardata"`
}

Skipped holds <skipped/> elements.

type Suite

type Suite struct {
	XMLName    xml.Name    `xml:"testsuite"`
	Suites     []Suite     `xml:"testsuite"`
	Name       string      `xml:"name,attr"`
	Properties *Properties `xml:"properties,omitempty"`
	Time       float64     `xml:"time,attr"` // Seconds
	TimeStamp  string      `xml:"timestamp,attr"`
	Failures   int         `xml:"failures,attr"`
	Tests      int         `xml:"tests,attr"`
	Disabled   int         `xml:"disabled,attr"`
	Skipped    int         `xml:"skipped,attr"`
	Errors     int         `xml:"errors,attr"`
	Results    []Result    `xml:"testcase"`
}

Suite holds <testsuite/> results

func (*Suite) Truncate added in v0.0.34

func (s *Suite) Truncate(max int)

Truncate ensures that strings do not exceed the specified length.

type Suites

type Suites struct {
	XMLName xml.Name `xml:"testsuites"`
	Suites  []Suite  `xml:"testsuite"`
}

Suites holds a <testsuites/> list of Suite results

func Parse

func Parse(buf []byte) (*Suites, error)

Parse returns the Suites representation of these XML bytes.

func ParseStream added in v0.0.34

func ParseStream(reader io.Reader) (*Suites, error)

ParseStream reads bytes into a Suites object.

func (*Suites) Truncate added in v0.0.34

func (s *Suites) Truncate(max int)

Truncate ensures that strings do not exceed the specified length.

Jump to

Keyboard shortcuts

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