formatter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CLRVersion = "unknown"

CLRVersion the default value of the CLR.

View Source
const NUnitVersion = "2.5.8.0"

NUnitVersion the version of NUnit

View Source
const OSVersion = "unknown"

OSVersion the default value of the OS.

View Source
const TestFixture = "TestFixture"

TestFixture the default fixture of a test.

View Source
const XUnitValidationMethod string = "Helm-Validation"

XUnitValidationMethod the default name for Helm XUnit validation.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	WriteTestOutput(testSuiteResults []*results.TestSuiteResult, noXMLHeader bool, w io.Writer) error
}

Formatter Interface.

func NewFormatter

func NewFormatter(outputFile, outputType string) Formatter

NewFormatter create a new Formatter.

func NewJUnitReportXML

func NewJUnitReportXML() Formatter

NewJUnitReportXML Constructor

func NewNUnitReportXML

func NewNUnitReportXML() Formatter

NewNUnitReportXML Constructor

func NewSonarReportXML added in v0.3.4

func NewSonarReportXML() Formatter

NewSonarReportXML Constructor

func NewXUnitReportXML

func NewXUnitReportXML() Formatter

NewXUnitReportXML Constructor

type JUnitFailure

type JUnitFailure struct {
	Message  string `xml:"message,attr"`
	Type     string `xml:"type,attr"`
	Contents string `xml:",chardata"`
}

JUnitFailure or error contains data related to a failed or errored test.

type JUnitProperty

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

JUnitProperty represents a key/value pair used to define properties.

type JUnitSkipMessage

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

JUnitSkipMessage contains the reason why a testcase was skipped.

type JUnitTestCase

type JUnitTestCase struct {
	XMLName     xml.Name          `xml:"testcase"`
	Classname   string            `xml:"classname,attr"`
	Name        string            `xml:"name,attr"`
	Time        string            `xml:"time,attr"`
	Error       *JUnitFailure     `xml:"error,omitempty"`
	SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
	Failure     *JUnitFailure     `xml:"failure,omitempty"`
}

JUnitTestCase is a single test case with its result.

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName     xml.Name        `xml:"testsuite"`
	Id          int             `xml:"id,attr"`
	Tests       int             `xml:"tests,attr"`
	Failures    int             `xml:"failures,attr"`
	Errors      int             `xml:"errors,attr"`
	Package     string          `xml:"package,attr"`
	Time        string          `xml:"time,attr"`
	Name        string          `xml:"name,attr"`
	Timestamp   string          `xml:"timestamp,attr"`
	Hostname    string          `xml:"hostname,attr"`
	Properties  []JUnitProperty `xml:"properties>property,omitempty"`
	TestCases   []JUnitTestCase `xml:"testcase"`
	SystemOut   string          `xml:"system-out,omitempty"`
	SystemError string          `xml:"system-err,omitempty"`
}

JUnitTestSuite is a single JUnit test suite which may contain many testcases.

type JUnitTestSuites

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

JUnitTestSuites is a collection of JUnit test suites.

type NUnitCategory

type NUnitCategory struct {
	Name string `xml:"name,attr"`
}

NUnitCategory is a testsuitecategory

type NUnitCultureInfo

type NUnitCultureInfo struct {
	XMLName          xml.Name `xml:"culture-info"`
	CurrentCulture   string   `xml:"current-culture,attr"`
	CurrentUICulture string   `xml:"current-uiculture,attr"`
}

NUnitCultureInfo is the environment settings.

type NUnitEnvironment

type NUnitEnvironment struct {
	XMLName      xml.Name `xml:"environment"`
	NUnitVersion string   `xml:"nunit-version,attr"`
	CLRVersion   string   `xml:"clr-version,attr"`
	OSVersion    string   `xml:"os-version,attr"`
	Platform     string   `xml:"platform,attr"`
	Cwd          string   `xml:"cwd,attr"`
	MachineName  string   `xml:"machine-name,attr"`
	User         string   `xml:"user,attr"`
	UserDomain   string   `xml:"user-domain,attr"`
}

NUnitEnvironment is the environment settings.

type NUnitFailure

type NUnitFailure struct {
	Message    string `xml:"message"`
	StackTrace string `xml:"stack-trace"`
}

NUnitFailure contains data related to a failed test.

type NUnitProperty

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

NUnitProperty represents a key/value pair used to define properties.

type NUnitReason

type NUnitReason struct {
	Message string `xml:"message"`
}

NUnitReason contains data related to a failed test.

type NUnitTestCase

type NUnitTestCase struct {
	XMLName     xml.Name      `xml:"test-case"`
	Failure     *NUnitFailure `xml:"failure,omitempty"`
	Reason      *NUnitReason  `xml:"reason,omitempty"`
	Name        string        `xml:"name,attr"`
	Description string        `xml:"description,attr"`
	Success     string        `xml:"success,attr"`
	Time        string        `xml:"time,attr"`
	Executed    string        `xml:"executed,attr"`
	Asserts     string        `xml:"asserts,attr"`
	Result      string        `xml:"result,attr"`
}

NUnitTestCase is a single test case with its result.

type NUnitTestResults

type NUnitTestResults struct {
	XMLName      xml.Name         `xml:"test-results"`
	Environment  NUnitEnvironment `xml:"environment"`
	CultureInfo  NUnitCultureInfo `xml:"culture-info"`
	TestSuite    []NUnitTestSuite `xml:"test-suite"`
	Name         string           `xml:"name,attr"`
	Total        int              `xml:"total,attr"`
	Errors       int              `xml:"errors,attr"`
	Failures     int              `xml:"failures,attr"`
	Inconclusive int              `xml:"inconclusive,attr"`
	NotRun       int              `xml:"not-run,attr"`
	Ignored      int              `xml:"ignored,attr"`
	Skipped      int              `xml:"skipped,attr"`
	Invalid      int              `xml:"invalid,attr"`
	Date         string           `xml:"date,attr"`
	Time         string           `xml:"time,attr"`
}

NUnitTestResults is a collection of NUnit test suites.

type NUnitTestSuite

type NUnitTestSuite struct {
	XMLName     xml.Name         `xml:"test-suite"`
	Failure     *NUnitFailure    `xml:"failure,omitempty"`
	Reason      *NUnitReason     `xml:"reason,omitempty"`
	TestSuites  []NUnitTestSuite `xml:"results>test-suite,omitempty"`
	TestCases   []NUnitTestCase  `xml:"results>test-case,omitempty"`
	Type        string           `xml:"type,attr"`
	Name        string           `xml:"name,attr"`
	Description string           `xml:"description,attr"`
	Success     string           `xml:"success,attr"`
	Time        string           `xml:"time,attr"`
	Executed    string           `xml:"executed,attr"`
	Asserts     string           `xml:"asserts,attr"`
	Result      string           `xml:"result,attr"`
}

NUnitTestSuite is a single NUnit test suite which may contain many testcases.

type SonarError added in v0.3.4

type SonarError struct {
	XMLName    xml.Name `xml:"error"`
	Message    string   `xml:"message,attr"`
	Stacktrace string   `xml:",cdata"`
}

SonarError is set when a test case have an error.

type SonarFailure added in v0.3.4

type SonarFailure struct {
	XMLName    xml.Name `xml:"failure"`
	Message    string   `xml:"message,attr"`
	Stacktrace string   `xml:",cdata"`
}

SonarFailure is set when a test case fails.

type SonarFile added in v0.3.4

type SonarFile struct {
	XMLName   xml.Name        `xml:"file"`
	Path      string          `xml:"path,attr"`
	TestCases []SonarTestCase `xml:"testCase"`
}

SonarFile is a single Sonar test file suite which may contain many testCases.

type SonarSkipped added in v0.3.4

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

SonarSkipped is set when a test case was skipped.

type SonarTestCase added in v0.3.4

type SonarTestCase struct {
	XMLName  xml.Name      `xml:"testCase"`
	Name     string        `xml:"name,attr"`
	Duration string        `xml:"duration,attr"`
	Error    *SonarError   `xml:"error,omitempty"`
	Skipped  *SonarSkipped `xml:"skipped,omitempty"`
	Failure  *SonarFailure `xml:"failure,omitempty"`
}

SonarTestCase is a single test case with its result.

type SonarTestExecutions added in v0.3.4

type SonarTestExecutions struct {
	XMLName xml.Name    `xml:"testExecutions"`
	Version int         `xml:"version,attr"`
	Files   []SonarFile `xml:"file"`
}

SonarTestExecutions is a collection of Sonar files.

type XUnitAssemblies

type XUnitAssemblies struct {
	XMLName  xml.Name        `xml:"assemblies"`
	Assembly []XUnitAssembly `xml:"assembly,omitempty"`
}

XUnitAssemblies the top level of the document.

type XUnitAssembly

type XUnitAssembly struct {
	XMLName       xml.Name       `xml:"assembly"`
	Name          string         `xml:"name,attr"`
	ConfigFile    string         `xml:"config-file,attr"`
	TestFramework string         `xml:"test-framework,attr"`
	Environment   string         `xml:"environment"`
	RunDate       string         `xml:"run-date,attr"`
	RunTime       string         `xml:"run-time,attr"`
	Time          string         `xml:"time,attr"`
	TotalTests    int            `xml:"total,attr"`
	PassedTests   int            `xml:"passed,attr"`
	FailedTests   int            `xml:"failed,attr"`
	SkippedTests  int            `xml:"skipped,attr"`
	ErrorsTests   int            `xml:"errors,attr"`
	Errors        []XUnitError   `xml:"errors>error,omitempty"`
	TestRuns      []XUnitTestRun `xml:"collection,omitempty"`
}

XUnitAssembly is a run of a single test assembly.

type XUnitError

type XUnitError struct {
	Type    string        `xml:"type,attr"`
	Name    string        `xml:"name,attr"`
	Failure *XUnitFailure `xml:"failure"`
}

XUnitError contains error information.

type XUnitErrors

type XUnitErrors struct {
	XMLName xml.Name     `xml:"errors"`
	Errors  []XUnitError `xml:"error,omitempty"`
}

XUnitErrors is a testsuitecategory

type XUnitFailure

type XUnitFailure struct {
	XMLName       xml.Name                `xml:"failure"`
	ExceptionType string                  `xml:"exception-type,attr"`
	Message       *XUnitFailureMessage    `xml:"message,omitempty"`
	StackTrace    *XUnitFailureStackTrace `xml:"stack-trace,omitempty"`
}

XUnitFailure contains data related to a failed test.

type XUnitFailureMessage

type XUnitFailureMessage struct {
	XMLName xml.Name `xml:"message"`
	Data    string   `xml:",cdata"`
}

XUnitFailureMessage contains the message of the failed test.

type XUnitFailureStackTrace

type XUnitFailureStackTrace struct {
	XMLName xml.Name `xml:"stack-trace"`
	Data    string   `xml:",cdata"`
}

XUnitFailureStackTrace constains the stacktrace of the failed test.

type XUnitReason

type XUnitReason struct {
	XMLName xml.Name `xml:"reason"`
	Reason  string   `xml:",cdata"`
}

XUnitReason contains reason why a test is skipped.

type XUnitTestCase

type XUnitTestCase struct {
	XMLName xml.Name      `xml:"test"`
	Name    string        `xml:"name,attr"`
	Type    string        `xml:"type,attr"`
	Method  string        `xml:"method,attr"`
	Time    string        `xml:"time,attr"`
	Result  string        `xml:"result,attr"`
	Traits  []XUnitTrait  `xml:"traits>trait,omitempty"`
	Failure *XUnitFailure `xml:"failure,omitempty"`
	Reason  *XUnitReason  `xml:"reason,omitempty"`
}

XUnitTestCase is a single test case with its result.

type XUnitTestRun

type XUnitTestRun struct {
	XMLName      xml.Name        `xml:"collection"`
	Name         string          `xml:"name,attr"`
	Time         string          `xml:"time,attr"`
	TotalTests   int             `xml:"total,attr"`
	PassedTests  int             `xml:"passed,attr"`
	FailedTests  int             `xml:"failed,attr"`
	SkippedTests int             `xml:"skipped,attr"`
	TestCases    []XUnitTestCase `xml:"test"`
}

XUnitTestRun is a single XUnit test suite which may contain many testcases.

type XUnitTrait

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

XUnitTrait contains a name/value pair.

Jump to

Keyboard shortcuts

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