reporter

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
)

Variables

This section is empty.

Functions

func PrintDoubleGroupJson added in v1.6.0

func PrintDoubleGroupJson(groupReports map[string]map[string][]Report) error

Prints the report for when two groups are passed in the groupby flag

func PrintDoubleGroupStdout added in v1.6.0

func PrintDoubleGroupStdout(groupReport map[string]map[string][]Report) error

Prints the report for when two groups are passed in the groupby flag

func PrintSingleGroupJson added in v1.6.0

func PrintSingleGroupJson(groupReports map[string][]Report) error

Prints the report for when one group is passed in the groupby flag

func PrintSingleGroupStdout added in v1.6.0

func PrintSingleGroupStdout(groupReport map[string][]Report) error

There is repeated code in the following two functions. Trying to consolidate the code into one function is difficult because of the output format

func PrintTripleGroupJson added in v1.6.0

func PrintTripleGroupJson(groupReports map[string]map[string]map[string][]Report) error

Prinnts the report for when three groups are passed in the groupby flag

func PrintTripleGroupStdout added in v1.6.0

func PrintTripleGroupStdout(groupReport map[string]map[string]map[string][]Report) error

Prints the report for when three groups are passed in the groupby flag

Types

type JsonReporter added in v1.3.0

type JsonReporter struct {
	// contains filtered or unexported fields
}

func NewJsonReporter added in v1.6.0

func NewJsonReporter(outputDest string) *JsonReporter

func (JsonReporter) Print added in v1.3.0

func (jr JsonReporter) Print(reports []Report) error

Print implements the Reporter interface by outputting the report content to stdout as JSON if outputDest flag is provided, output results to a file.

type JunitReporter added in v1.6.0

type JunitReporter struct {
	// contains filtered or unexported fields
}

func NewJunitReporter added in v1.6.0

func NewJunitReporter(outputDest string) *JunitReporter

func (JunitReporter) Print added in v1.6.0

func (jr JunitReporter) Print(reports []Report) error

type Message added in v1.6.0

type Message struct {
	InnerXML string `xml:",innerxml"`
}

type Property added in v1.6.0

type Property struct {
	XMLName   xml.Name `xml:"property"`
	TextValue string   `xml:",chardata"`
	Name      string   `xml:"name,attr"`
	Value     string   `xml:"value,attr,omitempty"`
}

type Report

type Report struct {
	FileName        string
	FilePath        string
	IsValid         bool
	ValidationError error
}

The Report object stores information about the report and the results of the validation

type Reporter

type Reporter interface {
	Print(reports []Report) error
}

Print accepts an array of Report objects and determines how to output the contents. Output could be stdout, files, etc

type Skipped added in v1.6.0

type Skipped struct {
	XMLName xml.Name `xml:"skipped"`
	Message string   `xml:"message,attr"`
}

type StdoutReporter

type StdoutReporter struct{}

func (StdoutReporter) Print

func (sr StdoutReporter) Print(reports []Report) error

Print implements the Reporter interface by outputting the report content to stdout

type SystemErr added in v1.6.0

type SystemErr struct {
	XMLName   xml.Name `xml:"system-err"`
	TextValue string   `xml:",chardata"`
}

type SystemOut added in v1.6.0

type SystemOut struct {
	XMLName   xml.Name `xml:"system-out"`
	TextValue string   `xml:",chardata"`
}

type Testcase added in v1.6.0

type Testcase struct {
	XMLName         xml.Name         `xml:"testcase"`
	Name            string           `xml:"name,attr"`
	ClassName       string           `xml:"classname,attr"`
	Assertions      int              `xml:"assertions,attr,omitempty"`
	Time            float32          `xml:"time,attr,omitempty"`
	File            string           `xml:"file,attr,omitempty"`
	Line            int              `xml:"line,attr,omitempty"`
	Skipped         *Skipped         `xml:"skipped,omitempty,omitempty"`
	Properties      *[]Property      `xml:"properties>property,omitempty"`
	TestcaseError   *TestcaseError   `xml:"error,omitempty"`
	TestcaseFailure *TestcaseFailure `xml:"failure,omitempty"`
}

type TestcaseError added in v1.6.0

type TestcaseError struct {
	XMLName   xml.Name `xml:"error"`
	Message   Message
	Type      string `xml:"type,omitempty"`
	TextValue string `xml:",chardata"`
}

type TestcaseFailure added in v1.6.0

type TestcaseFailure struct {
	XMLName xml.Name `xml:"failure"`
	// Message   string   `xml:"message,omitempty"`
	Message   Message
	Type      string `xml:"type,omitempty"`
	TextValue string `xml:",chardata"`
}

type Testsuite added in v1.6.0

type Testsuite struct {
	XMLName    xml.Name    `xml:"testsuite"`
	Name       string      `xml:"name,attr"`
	Tests      int         `xml:"tests,attr,omitempty"`
	Failures   int         `xml:"failures,attr,omitempty"`
	Errors     int         `xml:"errors,attr,omitempty"`
	Skipped    int         `xml:"skipped,attr,omitempty"`
	Assertions int         `xml:"assertions,attr,omitempty"`
	Time       float32     `xml:"time,attr,omitempty"`
	Timestamp  *time.Time  `xml:"timestamp,attr,omitempty"`
	File       string      `xml:"file,attr,omitempty"`
	Testcases  *[]Testcase `xml:"testcase,omitempty"`
	Properties *[]Property `xml:"properties>property,omitempty"`
	SystemOut  *SystemOut  `xml:"system-out,omitempty"`
	SystemErr  *SystemErr  `xml:"system-err,omitempty"`
}

type Testsuites added in v1.6.0

type Testsuites struct {
	XMLName    xml.Name    `xml:"testsuites"`
	Name       string      `xml:"name,attr,omitempty"`
	Tests      int         `xml:"tests,attr,omitempty"`
	Failures   int         `xml:"failures,attr,omitempty"`
	Errors     int         `xml:"errors,attr,omitempty"`
	Skipped    int         `xml:"skipped,attr,omitempty"`
	Assertions int         `xml:"assertions,attr,omitempty"`
	Time       float32     `xml:"time,attr,omitempty"`
	Timestamp  *time.Time  `xml:"timestamp,attr,omitempty"`
	Testsuites []Testsuite `xml:"testsuite"`
}

https://github.com/testmoapp/junitxml#basic-junit-xml-structure

Jump to

Keyboard shortcuts

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