Version: v0.8.28 Latest Latest

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

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


JUnit test reports



Package junit provides simplified structures for JUnit test reports.



This section is empty.


This section is empty.


This section is empty.


type TestCase

type TestCase struct {
	Name    string         `xml:"name,attr" json:"name"`
	File    string         `xml:"file,attr" json:"file"`
	Status  TestCaseStatus `xml:"status,attr" json:"status"`
	Time    *time.Duration `xml:"time,attr,omitempty" json:"time,omitempty"`
	Started *time.Time     `xml:"started,attr,omitempty" json:"started,omitempty"`
	Message string         `xml:"message,omitempty" json:"message,omitempty"`

TestCase information

func NewTestCase

func NewTestCase(name string, file string) *TestCase

NewTestCase creates a new TestCase

func (*TestCase) Finish

func (tc *TestCase) Finish(status TestCaseStatus, message ...string)

Finish the TestCase

type TestCaseStatus added in v0.8.10

type TestCaseStatus string

TestCaseStatus represents the status of the test case

const (
	Passed  TestCaseStatus = "passed"
	Failed  TestCaseStatus = "failed"
	Error   TestCaseStatus = "error"
	Skipped TestCaseStatus = "skipped"

type TestSuite

type TestSuite struct {
	Name     string        `xml:"name,attr" json:"name"`
	Total    int           `xml:"tests,attr" json:"tests"`
	Passed   int           `xml:"passed,attr" json:"passed"`
	Skipped  int           `xml:"skipped,attr" json:"skipped"`
	Failures int           `xml:"failures,attr" json:"failures"`
	Errors   int           `xml:"errors,attr" json:"errors"`
	TestCase []TestCase    `xml:"testcase" json:"testcase"`
	Started  time.Time     `xml:"started,attr" json:"timestamp"`
	Time     time.Duration `xml:"time,attr" json:"time"`
	Message  string        `xml:"message,omitempty" json:"message,omitempty"`

TestSuite information

func NewTestSuite

func NewTestSuite(name string) *TestSuite

NewTestSuite creates a new TestSuite

func (*TestSuite) Add

func (ts *TestSuite) Add(tc TestCase)

Add a TestCase to the TestSuite

func (*TestSuite) Finish added in v0.8.10

func (ts *TestSuite) Finish(message ...string)

Finish the TestSuite

Source Files

Jump to

Keyboard shortcuts

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