api

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: Apache-2.0 Imports: 3 Imported by: 525

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByName added in v1.2.0

type ByName []*TestSuite

ByName implements sort.Interface for []*TestSuite based on the Name field

func (ByName) Len added in v1.2.0

func (n ByName) Len() int

func (ByName) Less added in v1.2.0

func (n ByName) Less(i, j int) bool

func (ByName) Swap added in v1.2.0

func (n ByName) Swap(i, j int)

type FailureOutput

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

	// Message holds the failure message from the test
	Message string `xml:"message,attr"`

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

FailureOutput holds the output from a failing test

type SkipMessage

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

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

SkipMessage holds a message explaining why a test was skipped

type TestCase

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

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

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

	// 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"`
}

TestCase represents a jUnit test case

func (*TestCase) MarkFailed

func (t *TestCase) MarkFailed(message, output string)

MarkFailed marks the test as failed with the given message and output

func (*TestCase) MarkSkipped

func (t *TestCase) MarkSkipped(message string)

MarkSkipped marks the test as skipped with the given message

func (*TestCase) SetDuration

func (t *TestCase) SetDuration(duration string) error

SetDuration sets the runtime duration of the test case

func (*TestCase) String

func (t *TestCase) String() string

type TestResult

type TestResult string

TestResult is the result of a test case

const (
	TestResultPass TestResult = "pass"
	TestResultSkip TestResult = "skip"
	TestResultFail TestResult = "fail"
)

type TestSuite

type TestSuite 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,omitempty"`

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

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

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

func (*TestSuite) AddProperty

func (t *TestSuite) AddProperty(name, value string)

AddProperty adds a property to the test suite, deduplicating multiple additions of the same property by overwriting the previous record to reflect the new values

func (*TestSuite) AddTestCase

func (t *TestSuite) AddTestCase(testCase *TestCase)

AddTestCase adds a test case to the test suite and updates test suite metrics as necessary

func (*TestSuite) SetDuration

func (t *TestSuite) SetDuration(duration string) error

SetDuration sets the duration of the test suite if this value is not calculated by aggregating the durations of all of the substituent test cases. This should *not* be used if the total duration of the test suite is calculated as that sum, as AddTestCase will handle that case.

func (*TestSuite) String

func (t *TestSuite) String() string

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

func (*TestSuiteProperty) String

func (p *TestSuiteProperty) String() string

type TestSuites

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

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

TestSuites represents a flat collection of jUnit test suites.

func (*TestSuites) String

func (t *TestSuites) String() string

Jump to

Keyboard shortcuts

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