junit

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 51

Documentation

Overview

Package junit provides data structures to allow easy XML encoding and decoding of JUnit test results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	XMLName xml.Name `xml:"error"`

	Message string `xml:"message,attr,omitempty"`
	Type    string `xml:"type,attr"`

	Value string `xml:",cdata"`
}

Error represents the errors in a test case.

type Failure

type Failure struct {
	XMLName xml.Name `xml:"failure"`

	Message string `xml:"message,attr,omitempty"`
	Type    string `xml:"type,attr"`

	Value string `xml:",cdata"`
}

Failure represents the failures in a test case.

type Property

type Property struct {
	XMLName xml.Name `xml:"property"`

	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

Property is a simple key-value property that can be attached to a TestSuite.

type TestCase

type TestCase struct {
	XMLName xml.Name `xml:"testcase"`

	Name       string  `xml:"name,attr"`
	Classname  string  `xml:"classname,attr"`
	Status     string  `xml:"status,attr,omitempty"`
	Assertions int     `xml:"assertions,attr,omitempty"`
	Time       float64 `xml:"time,attr"`

	Skipped string `xml:"skipped,omitempty"`

	Errors   []*Error   `xml:"error,omitempty"`
	Failures []*Failure `xml:"failure,omitempty"`
}

TestCase represents a single test case within a suite.

type TestSuite

type TestSuite struct {
	XMLName xml.Name `xml:"testsuite"`

	Name      string    `xml:"name,attr"`
	Tests     int       `xml:"tests,attr"`
	Disabled  int       `xml:"disabled,attr,omitempty"`
	Errors    int       `xml:"errors,attr"`
	Failures  int       `xml:"failures,attr"`
	Skipped   int       `xml:"skipped,attr,omitempty"`
	Time      float64   `xml:"time,attr"`
	Timestamp time.Time `xml:"timestamp,attr"`
	ID        int       `xml:"id,attr,omitempty"`
	Package   string    `xml:"package,attr,omitempty"`
	Hostname  string    `xml:"hostname,attr"`

	Properties []*Property `xml:"properties,omitempty"`
	TestCases  []*TestCase `xml:"testcase"`

	SystemOut string `xml:"system-out,omitempty"`
	SystemErr string `xml:"system-err,omitempty"`
}

TestSuite is a top-level test suite containing test cases.

func (*TestSuite) Update

func (t *TestSuite) Update()

Update iterates through the TestCases and updates Tests, Errors, Failures, and Skipped top level attributes.

Jump to

Keyboard shortcuts

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