junit

package
v0.129.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const JunitFileName = "junit.xml"

JunitFileName is the name of the JUnit report.

Variables

This section is empty.

Functions

This section is empty.

Types

type Property added in v0.62.0

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

Property maps to a <property> element that's part of <properties>.

type Reporter added in v0.62.0

type Reporter struct {
	TestResults []report.TestResult
	Filename    string
	// contains filtered or unexported fields
}

Reporter is a junit implementation for report.Reporter.

func (*Reporter) Add added in v0.62.0

func (r *Reporter) Add(t report.TestResult)

Add adds the test result to the summary.

func (*Reporter) ArtifactRequirements added in v0.62.0

func (r *Reporter) ArtifactRequirements() []report.ArtifactType

ArtifactRequirements returns a list of artifact types are this reporter requires to create a proper report.

func (*Reporter) Render added in v0.62.0

func (r *Reporter) Render()

Render renders out a test summary junit report to the destination of Reporter.Filename.

func (*Reporter) Reset added in v0.62.0

func (r *Reporter) Reset()

Reset resets the reporter to its initial state. This action will delete all test results.

type TestCase

type TestCase struct {
	Name       string `xml:"name,attr"`
	Assertions string `xml:"assertions,attr,omitempty"`
	Time       string `xml:"time,attr"`
	Timestamp  string `xml:"timestamp,attr"`
	ClassName  string `xml:"classname,attr"`
	Status     string `xml:"status,attr,omitempty"`
	SystemOut  string `xml:"system-out,omitempty"`
	Error      string `xml:"error,omitempty"`
	Failure    string `xml:"failure,omitempty"`
}

TestCase maps to <testcase> element

type TestSuite

type TestSuite struct {
	Name       string     `xml:"name,attr"`
	Tests      int        `xml:"tests,attr"`
	Properties []Property `xml:"properties>property"`
	Errors     int        `xml:"errors,attr,omitempty"`
	Failures   int        `xml:"failures,attr,omitempty"`
	Disabled   int        `xml:"disabled,attr,omitempty"`
	Skipped    int        `xml:"skipped,attr,omitempty"`
	Time       string     `xml:"time,attr,omitempty"`
	Timestamp  string     `xml:"timestamp,attr,omitempty"`
	Package    string     `xml:"package,attr,omitempty"`
	TestCases  []TestCase `xml:"testcase"`
	SystemOut  string     `xml:"system-out,omitempty"`
}

TestSuite maps to <testsuite> element

type TestSuites

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

TestSuites maps to root junit <testsuites> element

func Parse

func Parse(data []byte) (TestSuites, error)

Parse parses an xml-encoded byte string and returns a `TestSuites` struct The root <testsuites> element is optional so if its missing, Parse will parse a <testsuite> and wrap it in a `TestSuites` struct

Jump to

Keyboard shortcuts

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