junit

package
v0.0.0-...-62801f1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCase

type TestCase struct {
	Name       string         `xml:"name,attr"`
	Time       float64        `xml:"time,attr"` // Seconds
	ClassName  string         `xml:"classname,attr"`
	Failure    *string        `xml:"failure,omitempty"`
	Output     *string        `xml:"system-out,omitempty"`
	Error      *string        `xml:"system-err,omitempty"`
	Skipped    *string        `xml:"skipped,omitempty"`
	Properties TestProperties `xml:"properties"`
}

TestCase holds <testcase/> results

func (*TestCase) AddProperty

func (testCase *TestCase) AddProperty(name, val string)

AddProperty adds property to testcase

func (*TestCase) GetTestStatus

func (testCase *TestCase) GetTestStatus() TestStatusEnum

GetTestStatus returns the test status as a string

type TestProperties

type TestProperties struct {
	Properties []TestProperty `xml:"property"`
}

TestProperties is an array of test properties

type TestProperty

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

TestProperty defines a property of the test

type TestStatusEnum

type TestStatusEnum string

TestStatusEnum is a enum for test result status

const (
	// Failed means junit test failed
	Failed TestStatusEnum = "failed"
	// Skipped means junit test skipped
	Skipped TestStatusEnum = "skipped"
	// Passed means junit test passed
	Passed TestStatusEnum = "passed"
)

type TestSuite

type TestSuite struct {
	XMLName    xml.Name       `xml:"testsuite"`
	Name       string         `xml:"name,attr"`
	Time       float64        `xml:"time,attr"` // Seconds
	Failures   int            `xml:"failures,attr"`
	Tests      int            `xml:"tests,attr"`
	TestCases  []TestCase     `xml:"testcase"`
	Properties TestProperties `xml:"properties"`
}

TestSuite holds <testSuite/> results

func (*TestSuite) AddTestCase

func (ts *TestSuite) AddTestCase(tc TestCase)

AddTestCase adds a testcase to the testsuite

type TestSuites

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

TestSuites holds a <testSuites/> list of TestSuite results

func UnMarshal

func UnMarshal(buf []byte) (*TestSuites, error)

UnMarshal converts bytes array to TestSuites struct, it works with both TestSuites and TestSuite structs, if input is a TestSuite struct it will still return a TestSuites struct, which is an empty wrapper TestSuites containing only the input Suite

func (*TestSuites) AddTestSuite

func (testSuites *TestSuites) AddTestSuite(testSuite *TestSuite) error

AddTestSuite adds TestSuite to TestSuites

func (*TestSuites) GetTestSuite

func (testSuites *TestSuites) GetTestSuite(suiteName string) (*TestSuite, error)

GetTestSuite gets TestSuite struct by name

func (*TestSuites) ToBytes

func (testSuites *TestSuites) ToBytes(prefix, indent string) ([]byte, error)

ToBytes converts TestSuites struct to bytes array

Jump to

Keyboard shortcuts

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