ginkgo

package
v0.0.0-...-3256294 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SuitesString

func SuitesString(suites []*TestSuite, prefix string) string

SuitesString returns a string with the provided suites formatted. Prefix is printed at the beginning of the output.

Types

type ExitError

type ExitError struct {
	Code int
}

func (ExitError) Error

func (e ExitError) Error() string

type FailureOutput

type FailureOutput struct {
	XMLName xml.Name `xml:"failure"`

	// Message holds the failure message from the test
	Message string `xml:"message,attr"`

	// Output holds verbose failure output from the test
	Output string `xml:",chardata"`
}

FailureOutput holds the output from a failing test

type JUnitTestCase

type JUnitTestCase struct {
	XMLName xml.Name `xml:"testcase"`

	// Name is the name of the test case
	Name string `xml:"name,attr"`

	// Classname is an attribute set by the package type and is required
	Classname string `xml:"classname,attr,omitempty"`

	// Duration is the time taken in seconds to run the test
	Duration float64 `xml:"time,attr"`

	// SkipMessage holds the reason why the test was skipped
	SkipMessage *SkipMessage `xml:"skipped"`

	// FailureOutput holds the output from a failing test
	FailureOutput *FailureOutput `xml:"failure"`

	// SystemOut is output written to stdout during the execution of this test case
	SystemOut string `xml:"system-out,omitempty"`

	// SystemErr is output written to stderr during the execution of this test case
	SystemErr string `xml:"system-err,omitempty"`
}

JUnitTestCase represents a jUnit test case

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName xml.Name `xml:"testsuite"`

	// Name is the name of the test suite
	Name string `xml:"name,attr"`

	// NumTests records the number of tests in the TestSuite
	NumTests uint `xml:"tests,attr"`

	// NumSkipped records the number of skipped tests in the suite
	NumSkipped uint `xml:"skipped,attr"`

	// NumFailed records the number of failed tests in the suite
	NumFailed uint `xml:"failures,attr"`

	// Duration is the time taken in seconds to run all tests in the suite
	Duration float64 `xml:"time,attr"`

	// Properties holds other properties of the test suite as a mapping of name to value
	Properties []*TestSuiteProperty `xml:"properties,omitempty"`

	// TestCases are the test cases contained in the test suite
	TestCases []*JUnitTestCase `xml:"testcase"`

	// Children holds nested test suites
	Children []*JUnitTestSuite `xml:"testsuite"`
}

TestSuite represents a single jUnit test suite, potentially holding child suites.

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName xml.Name `xml:"testsuites"`

	// Suites are the jUnit test suites held in this collection
	Suites []*JUnitTestSuite `xml:"testsuite"`
}

TestSuites represents a flat collection of jUnit test suites.

type MinimalReporter

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

func NewMinimalReporter

func NewMinimalReporter(name string, location types.CodeLocation) *MinimalReporter

func (*MinimalReporter) AfterSuiteDidRun

func (r *MinimalReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary)

func (*MinimalReporter) BeforeSuiteDidRun

func (r *MinimalReporter) BeforeSuiteDidRun(setup *types.SetupSummary)

func (*MinimalReporter) Fail

func (r *MinimalReporter) Fail()

func (*MinimalReporter) SpecDidComplete

func (r *MinimalReporter) SpecDidComplete(spec *types.SpecSummary)

func (*MinimalReporter) SpecSuiteDidEnd

func (r *MinimalReporter) SpecSuiteDidEnd(summary *types.SuiteSummary)

func (*MinimalReporter) SpecSuiteWillBegin

func (r *MinimalReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary)

func (*MinimalReporter) SpecWillRun

func (r *MinimalReporter) SpecWillRun(spec *types.SpecSummary)

func (*MinimalReporter) Summary

type Options

type Options struct {
	Parallelism int
	Count       int
	Timeout     time.Duration
	JUnitDir    string
	TestFile    string
	OutFile     string
	Regex       string

	IncludeSuccessOutput bool

	Provider     string
	SuiteOptions string

	Suites []*TestSuite

	DryRun        bool
	PrintCommands bool
	Out, ErrOut   io.Writer
}

Options is used to run a suite of tests by invoking each test as a call to a child worker (the run-tests command).

func (*Options) AsEnv

func (opt *Options) AsEnv() []string

func (*Options) Run

func (opt *Options) Run(args []string) error

type SkipMessage

type SkipMessage struct {
	XMLName xml.Name `xml:"skipped"`

	// Message explains why the test was skipped
	Message string `xml:"message,attr,omitempty"`
}

SkipMessage holds a message explaining why a test was skipped

type TestFunc

type TestFunc func(ctx context.Context, test *testCase)

type TestOptions

type TestOptions struct {
	DryRun      bool
	Out, ErrOut io.Writer
}

TestOptions handles running a single test.

func (*TestOptions) Run

func (opt *TestOptions) Run(args []string) error

type TestResult

type TestResult string

TestResult is the result of a test case

const (
	TestResultPass TestResult = "pass"
	TestResultSkip TestResult = "skip"
	TestResultFail TestResult = "fail"
)

type TestSuite

type TestSuite struct {
	Name        string
	Description string

	Matches func(name string) bool

	// Init should be run once before a test in this suite is run. Not called by
	// methods in this package.
	Init func(map[string]string) error

	// The number of times to execute each test in this suite.
	Count int
	// The maximum parallelism of this suite.
	Parallelism int
	// The number of flakes that may occur before this test is marked as a failure.
	MaximumAllowedFlakes int

	TestTimeout time.Duration
}

func (*TestSuite) Filter

func (s *TestSuite) Filter(tests []*testCase) []*testCase

type TestSuiteProperty

type TestSuiteProperty struct {
	XMLName xml.Name `xml:"property"`

	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

TestSuiteProperty contains a mapping of a property name to a value

Jump to

Keyboard shortcuts

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