xunit

package
v0.0.0-...-366ddcd Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2016 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package xunit contains types and functions for manipulating xunit files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFailureReport

func CreateFailureReport(jirix *jiri.X, testName, pkgName, testCaseName, failureMessage, failureOutput string) error

CreateFailureReport creates an xUnit report for the given failure.

func CreateReport

func CreateReport(jirix *jiri.X, testName string, suites []TestSuite) error

CreateReport generates an xUnit report using the given test suites.

func ReportPath

func ReportPath(testName string) string

ReportPath returns the path to the xUnit file.

TODO(jsimsa): Once all Jenkins shell test scripts are ported to Go, change the filename to xunit_report_<testName>.xml.

Types

type Error

type Error struct {
	Message string `xml:"message,attr"`
	Data    string `xml:",chardata"`
}

type Failure

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

type TestCase

type TestCase struct {
	Name      string    `xml:"name,attr"`
	Classname string    `xml:"classname,attr"`
	Errors    []Error   `xml:"error"`
	Failures  []Failure `xml:"failure"`
	Time      string    `xml:"time,attr"`
	Skipped   []string  `xml:"skipped"`
}

type TestSuite

type TestSuite struct {
	Name     string     `xml:"name,attr"`
	Cases    []TestCase `xml:"testcase"`
	Errors   int        `xml:"errors,attr"`
	Failures int        `xml:"failures,attr"`
	Skip     int        `xml:"skip,attr"`
	Tests    int        `xml:"tests,attr"`
}

func CreateTestSuiteWithFailure

func CreateTestSuiteWithFailure(pkgName, testName, failureMessage, failureOutput string, duration time.Duration) *TestSuite

CreateTestSuiteWithFailure encodes the given information as a test suite with a single failure.

func TestSuitesFromGoTestOutput

func TestSuitesFromGoTestOutput(jirix *jiri.X, testOutput io.Reader) ([]*TestSuite, error)

TestSuitesFromGoTestOutput reads data from the given input, assuming it contains test results generated by "go test -v", and returns it as an in-memory data structure.

type TestSuites

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

Jump to

Keyboard shortcuts

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