reporters

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Ginkgo's Default Reporter

A number of command line flags are available to tweak Ginkgo's default output.

These are documented [here](http://onsi.github.io/ginkgo/#running_tests)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJSONReport

func GenerateJSONReport(report types.Report, destination string) error

GenerateJSONReport produces a JSON-formatted report at the passed in destination

func GenerateJUnitReport

func GenerateJUnitReport(report types.Report, dst string) error

func GenerateTeamcityReport

func GenerateTeamcityReport(report types.Report, dst string) error

func MergeAndCleanupJSONReports

func MergeAndCleanupJSONReports(sources []string, destination string) ([]string, error)

MergeJSONReports produces a single JSON-formatted report at the passed in destination by merging the JSON-formatted reports provided in sources It skips over reports that fail to decode but reports on them via the returned messages []string

func MergeAndCleanupJUnitReports

func MergeAndCleanupJUnitReports(sources []string, dst string) ([]string, error)

func MergeAndCleanupTeamcityReports

func MergeAndCleanupTeamcityReports(sources []string, dst string) ([]string, error)

func ReportViaDeprecatedReporter deprecated

func ReportViaDeprecatedReporter(reporter DeprecatedReporter, report types.Report)

ReportViaDeprecatedReporter takes a V1 custom reporter and a V2 report and calls the custom reporter's methods with appropriately transformed data from the V2 report.

ReportViaDeprecatedReporter should be called in a `ReportAfterSuite()`

Deprecated: ReportViaDeprecatedReporter method exists to help developer bridge between deprecated V1 functionality and the new reporting support in V2. It will be removed in a future minor version of Ginkgo.

Types

type DefaultReporter

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

func NewDefaultReporter

func NewDefaultReporter(conf types.ReporterConfig, writer io.Writer) *DefaultReporter

func NewDefaultReporterUnderTest

func NewDefaultReporterUnderTest(conf types.ReporterConfig, writer io.Writer) *DefaultReporter

func (*DefaultReporter) DidRun

func (r *DefaultReporter) DidRun(report types.SpecReport)

func (*DefaultReporter) SuiteDidEnd

func (r *DefaultReporter) SuiteDidEnd(report types.Report)

func (*DefaultReporter) SuiteWillBegin

func (r *DefaultReporter) SuiteWillBegin(report types.Report)

func (*DefaultReporter) WillRun

func (r *DefaultReporter) WillRun(report types.SpecReport)

type DeprecatedReporter deprecated

type DeprecatedReporter interface {
	SuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary)
	BeforeSuiteDidRun(setupSummary *types.SetupSummary)
	SpecWillRun(specSummary *types.SpecSummary)
	SpecDidComplete(specSummary *types.SpecSummary)
	AfterSuiteDidRun(setupSummary *types.SetupSummary)
	SuiteDidEnd(summary *types.SuiteSummary)
}

Deprecated: DeprecatedReporter was how Ginkgo V1 provided support for CustomReporters this has been removed in V2. Please read the documentation at: https://github.com/onsi/ginkgo/blob/v2/docs/MIGRATING_TO_V2.md#removed-custom-reporters for Ginkgo's new behavior and for a migration path.

type JUnitError

type JUnitError struct {
	//Message maps onto the panic/exception thrown - equivalent to SpecReport.Failure.ForwardedPanic - or to "interupted"
	Message string `xml:"message,attr"`
	//Type is one of "panicked" or "interrupted"
	Type string `xml:"type,attr"`
	//Description maps onto the captured stack trace for a panic, or the failure message for an interrupt which will include the dump of running goroutines
	Description string `xml:",chardata"`
}

type JUnitFailure

type JUnitFailure struct {
	//Message maps onto the failure message - equivalent to SpecReport.Failure.Message
	Message string `xml:"message,attr"`
	//Type is "failed"
	Type string `xml:"type,attr"`
	//Description maps onto the location and stack trace of the failure
	Description string `xml:",chardata"`
}

type JUnitProperties

type JUnitProperties struct {
	Properties []JUnitProperty `xml:"property"`
}

func (JUnitProperties) WithName

func (jup JUnitProperties) WithName(name string) string

type JUnitProperty

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

type JUnitReporter

type JUnitReporter struct{}

Deprecated JUnitReporter (so folks can still compile their suites)

func NewJUnitReporter

func NewJUnitReporter(_ string) *JUnitReporter

func (*JUnitReporter) AfterSuiteDidRun

func (reporter *JUnitReporter) AfterSuiteDidRun(_ *types.SetupSummary)

func (*JUnitReporter) BeforeSuiteDidRun

func (reporter *JUnitReporter) BeforeSuiteDidRun(_ *types.SetupSummary)

func (*JUnitReporter) SpecDidComplete

func (reporter *JUnitReporter) SpecDidComplete(_ *types.SpecSummary)

func (*JUnitReporter) SpecWillRun

func (reporter *JUnitReporter) SpecWillRun(_ *types.SpecSummary)

func (*JUnitReporter) SuiteDidEnd

func (reporter *JUnitReporter) SuiteDidEnd(_ *types.SuiteSummary)

func (*JUnitReporter) SuiteWillBegin

func (reporter *JUnitReporter) SuiteWillBegin(_ config.GinkgoConfigType, _ *types.SuiteSummary)

type JUnitSkipped

type JUnitSkipped struct {
	// Message maps onto "pending" if the test was marked pending, "skipped" if the test was marked skipped, and "skipped - REASON" if the user called Skip(REASON)
	Message string `xml:"message,attr"`
}

type JUnitTestCase

type JUnitTestCase struct {
	// Name maps onto the full text of the spec - equivalent to "[SpecReport.LeafNodeType] SpecReport.FullText()"
	Name string `xml:"name,attr"`
	// Classname maps onto the name of the test suite - equivalent to Report.SuiteDescription
	Classname string `xml:"classname,attr"`
	// Status maps onto the string representation of SpecReport.State
	Status string `xml:"status,attr"`
	// Time is the time in seconds to execute the spec - maps onto SpecReport.RunTime
	Time float64 `xml:"time,attr"`
	//Skipped is populated with a message if the test was skipped or pending
	Skipped *JUnitSkipped `xml:"skipped,omitempty"`
	//Error is populated if the test panicked or was interrupted
	Error *JUnitError `xml:"error,omitempty"`
	//Failure is populated if the test failed
	Failure *JUnitFailure `xml:"failure,omitempty"`
	//SystemOut maps onto any captured stdout/stderr output - maps onto SpecReport.CapturedStdOutErr
	SystemOut string `xml:"system-out,omitempty"`
	//SystemOut maps onto any captured GinkgoWriter output - maps onto SpecReport.CapturedGinkgoWriterOutput
	SystemErr string `xml:"system-err,omitempty"`
}

type JUnitTestSuite

type JUnitTestSuite struct {
	// Name maps onto the description of the test suite - maps onto Report.SuiteDescription
	Name string `xml:"name,attr"`
	// Package maps onto the aboslute path to the test suite - maps onto Report.SuitePath
	Package string `xml:"package,attr"`
	// Tests maps onto the total number of specs in the test suite (this includes any suite nodes such as BeforeSuite)
	Tests int `xml:"tests,attr"`
	// Disabled maps onto specs that are pending
	Disabled int `xml:"disabled,attr"`
	// Skiped maps onto specs that are skipped
	Skipped int `xml:"skipped,attr"`
	// Errors maps onto specs that panicked or were interrupted
	Errors int `xml:"errors,attr"`
	// Failures maps onto specs that failed
	Failures int `xml:"failures,attr"`
	// Time is the time in seconds to execute all the test suite - maps onto Report.RunTime
	Time float64 `xml:"time,attr"`
	// Timestamp is the ISO 8601 formatted start-time of the suite - maps onto Report.StartTime
	Timestamp string `xml:"timestamp,attr"`

	//Properties captures the information stored in the rest of the Report type (including SuiteConfig) as key-value pairs
	Properties JUnitProperties `xml:"properties"`

	//TestCases capture the individual specs
	TestCases []JUnitTestCase `xml:"testcase"`
}

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName xml.Name `xml:"testsuites"`
	// Tests maps onto the total number of specs in all test suites (this includes any suite nodes such as BeforeSuite)
	Tests int `xml:"tests,attr"`
	// Disabled maps onto specs that are pending and/or skipped
	Disabled int `xml:"disabled,attr"`
	// Errors maps onto specs that panicked or were interrupted
	Errors int `xml:"errors,attr"`
	// Failures maps onto specs that failed
	Failures int `xml:"failures,attr"`
	// Time is the time in seconds to execute all test suites
	Time float64 `xml:"time,attr"`

	//The set of all test suites
	TestSuites []JUnitTestSuite `xml:"testsuite"`
}

type NoopReporter

type NoopReporter struct{}

func (NoopReporter) DidRun

func (n NoopReporter) DidRun(report types.SpecReport)

func (NoopReporter) SuiteDidEnd

func (n NoopReporter) SuiteDidEnd(report types.Report)

func (NoopReporter) SuiteWillBegin

func (n NoopReporter) SuiteWillBegin(report types.Report)

func (NoopReporter) WillRun

func (n NoopReporter) WillRun(report types.SpecReport)

type Reporter

type Reporter interface {
	SuiteWillBegin(report types.Report)
	WillRun(report types.SpecReport)
	DidRun(report types.SpecReport)
	SuiteDidEnd(report types.Report)
}

Jump to

Keyboard shortcuts

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