Help us shape the future of Go! Take the 2026 Go Developer Survey

junitapi

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToExtensionTestResults

func ToExtensionTestResults(junits []*JUnitTestCase) extensiontests.ExtensionTestResults

ToExtensionTestResults converts JUnit test cases to ExtensionTestResults so they can be included in the extension test result JSON/HTML output.

Types

type FailureOutput

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

	// Output holds verbose failure output from the test
	Output string `xml:",chardata"`
}

FailureOutput holds the output from a failing test

type JUnitTestCase

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

	// Name is the name of the test case
	Name string `xml:"name,attr"`

	// Classname is an attribute set by the package type and is required
	Classname string `xml:"classname,attr,omitempty"`

	// Duration is the time taken in seconds to run the test
	Duration float64 `xml:"time,attr"`

	// OTE metadata attributes
	StartTime    string `xml:"start-time,attr,omitempty"`
	EndTime      string `xml:"end-time,attr,omitempty"`
	Lifecycle    string `xml:"lifecycle,attr,omitempty"`
	SourceImage  string `xml:"source-image,attr,omitempty"`
	SourceBinary string `xml:"source-binary,attr,omitempty"`
	SourceURL    string `xml:"source-url,attr,omitempty"`
	SourceCommit string `xml:"source-commit,attr,omitempty"`

	// Properties holds test case properties as key-value pairs
	Properties []*TestCaseProperty `xml:"properties>property,omitempty"`

	// SkipMessage holds the reason why the test was skipped
	SkipMessage *SkipMessage `xml:"skipped"`

	// FailureOutput holds the output from a failing test
	FailureOutput *FailureOutput `xml:"failure"`

	// SystemOut is output written to stdout during the execution of this test case
	SystemOut string `xml:"system-out,omitempty"`

	// SystemErr is output written to stderr during the execution of this test case
	SystemErr string `xml:"system-err,omitempty"`
}

JUnitTestCase represents a jUnit test case

type JUnitTestSuite

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

	// Name is the name of the test suite
	Name string `xml:"name,attr"`

	// NumTests records the number of tests in the TestSuite
	NumTests uint `xml:"tests,attr"`

	// NumSkipped records the number of skipped tests in the suite
	NumSkipped uint `xml:"skipped,attr"`

	// NumFailed records the number of failed tests in the suite
	NumFailed uint `xml:"failures,attr"`

	// Duration is the time taken in seconds to run all tests in the suite
	Duration float64 `xml:"time,attr"`

	// Properties holds other properties of the test suite as a mapping of name to value
	Properties []*TestSuiteProperty `xml:"properties>property,omitempty"`

	// TestCases are the test cases contained in the test suite
	TestCases []*JUnitTestCase `xml:"testcase"`

	// Children holds nested test suites
	Children []*JUnitTestSuite `xml:"testsuite"`
}

TestSuite represents a single jUnit test suite, potentially holding child suites.

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName xml.Name `xml:"testsuites"`

	// Suites are the jUnit test suites held in this collection
	Suites []*JUnitTestSuite `xml:"testsuite"`
}

TestSuites represents a flat collection of jUnit test suites.

type SkipMessage

type SkipMessage struct {
	XMLName xml.Name `xml:"skipped"`

	// Message explains why the test was skipped
	Message string `xml:"message,attr,omitempty"`
}

SkipMessage holds a message explaining why a test was skipped

type TestCaseProperty added in v1.6.0

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

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

TestCaseProperty contains a mapping of a property name to a value

type TestSuiteProperty

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

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

TestSuiteProperty contains a mapping of a property name to a value

Jump to

Keyboard shortcuts

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