junit

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(suites TestSuites) ([]byte, error)

func Write

func Write(out io.Writer, suites TestSuites) error

Types

type Failure

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

Failure contains data related to a failed test.

type Property

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

Property represents a key/value pair used to define properties.

type SkipMessage

type SkipMessage struct {
	Message string `xml:"message,attr"`
}

SkipMessage contains the reason why a testcase was skipped.

type TestCase

type TestCase struct {
	XMLName     xml.Name     `xml:"testcase"`
	Classname   string       `xml:"classname,attr"`
	Name        string       `xml:"name,attr"`
	Time        string       `xml:"time,attr"`
	SkipMessage *SkipMessage `xml:"skipped,omitempty"`
	Properties  []Property   `xml:"properties>property,omitempty"`
	Failure     *Failure     `xml:"failure,omitempty"`
}

TestCase is a single test case with its result.

type TestSuite

type TestSuite struct {
	XMLName    xml.Name   `xml:"testsuite"`
	Tests      int        `xml:"tests,attr"`
	Failures   int        `xml:"failures,attr"`
	Skipped    int        `xml:"skipped,attr"`
	Time       string     `xml:"time,attr"`
	Name       string     `xml:"name,attr"`
	Properties []Property `xml:"properties>property,omitempty"`
	TestCases  []TestCase
	Timestamp  string `xml:"timestamp,attr"`
}

TestSuite is a single JUnit test suite which may contain many testcases.

func NewTestSuite

func NewTestSuite(name string) TestSuite

func (*TestSuite) AddCase

func (id *TestSuite) AddCase(tcase TestCase)

func (*TestSuite) WithCase added in v0.10.0

func (id *TestSuite) WithCase(tcase TestCase) *TestSuite

type TestSuites

type TestSuites struct {
	XMLName  xml.Name `xml:"testsuites"`
	Name     string   `xml:"name,attr,omitempty"`
	Tests    int      `xml:"tests,attr"`
	Failures int      `xml:"failures,attr"`
	Errors   int      `xml:"errors,attr"`
	Skipped  int      `xml:"skipped,attr"`
	Time     string   `xml:"time,attr"`
	Suites   []TestSuite
}

TestSuites is a collection of JUnit test suites.

func NewTestSuites

func NewTestSuites(name string) *TestSuites

func (*TestSuites) AddSuite

func (id *TestSuites) AddSuite(suite TestSuite)

func (*TestSuites) WithSuite

func (id *TestSuites) WithSuite(suite TestSuite) *TestSuites

Jump to

Keyboard shortcuts

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