junitgo

package module
v0.0.0-...-bf1b4d3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: MIT Imports: 3 Imported by: 0

README

go-junit-report

Simple Library that can be used to generate xml reports, suitable for applications that expect junit xml reports (e.g. Jenkins).

Build Status Report Card Code Coverage

Installation

Go version 1.3 or higher is required. Install or update using the go get command:

go get -u github.com/UncleKing/junit-go

Contribution

Create an Issue and discuss the fix or feature, then fork the package. Clone to github.com/UncleKing/junit-go. This is necessary because go import uses this path.

Run Tests

go test

Usage

Please check the test code to see how the library can be used.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Failure

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

type Properties

type Properties []Property

type Property

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

type SkipMessage

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

type TestCase

type TestCase struct {
	ClassName   string       `xml:"classname,attr,omitempty"`
	Name        string       `xml:"name,attr"`
	Time        string       `xml:"time,attr"`
	Failure     *Failure     `xml:"failure"`
	SkipMessage *SkipMessage `xml:"skipped,omitempty"`
	Systemout   string       `xml:"system-out,omitempty"`
	Systemerr   string       `xml:"system-err,omitempty"`
}

type TestRun

type TestRun struct {
	XMLName    xml.Name `xml:"testsuites"`
	Name       string   `xml:"name,attr,omitempty"`
	TestSuites []*TestSuite
}

func (*TestRun) AddTestSuite

func (tr *TestRun) AddTestSuite(props Properties, hostname string, name string, pkg string, id string) *TestSuite

func (TestRun) WriteResults

func (tr TestRun) WriteResults(writer io.Writer) error

func (TestRun) WriteToFile

func (tr TestRun) WriteToFile(path string) error

type TestSuite

type TestSuite struct {
	XMLName    xml.Name   `xml:"testsuite"`
	Errors     int        `xml:"errors,attr"`
	Failures   int        `xml:"failures,attr"`
	Hostname   string     `xml:"hostname,attr"`
	Name       string     `xml:"name,attr"`
	Tests      int        `xml:"tests,attr"`
	Time       float64    `xml:"time,attr"`
	Timestamp  string     `xml:"timestamp,attr"`
	Properties Properties `xml:"properties>property,omitempty"`
	Testcases  []TestCase `xml:"testcase"`
	Package    string     `xml:"package"`
	Id         string     `xml:"id"`
}

func (*TestSuite) AddTestCase

func (ts *TestSuite) AddTestCase(class string, name string, time string, failure *Failure, stdout string, stderr string)

Jump to

Keyboard shortcuts

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