ginkgoext

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Context                               = wrapContextFunc(ginkgo.Context, false)
	FContext                              = wrapContextFunc(ginkgo.FContext, true)
	PContext                              = wrapNilContextFunc(ginkgo.PContext)
	XContext                              = wrapNilContextFunc(ginkgo.XContext)
	Describe                              = wrapContextFunc(ginkgo.Describe, false)
	FDescribe                             = wrapContextFunc(ginkgo.FDescribe, true)
	PDescribe                             = wrapNilContextFunc(ginkgo.PDescribe)
	XDescribe                             = wrapNilContextFunc(ginkgo.XDescribe)
	It                                    = wrapItFunc(ginkgo.It, false)
	FIt                                   = wrapItFunc(ginkgo.FIt, true)
	PIt                                   = ginkgo.PIt
	XIt                                   = ginkgo.XIt
	Measure                               = ginkgo.Measure
	JustBeforeEach                        = ginkgo.JustBeforeEach
	BeforeSuite                           = ginkgo.BeforeSuite
	AfterSuite                            = ginkgo.AfterSuite
	Skip                                  = ginkgo.Skip
	Fail                                  = FailWithToggle
	CurrentGinkgoTestDescription          = ginkgo.CurrentGinkgoTestDescription
	GinkgoRecover                         = ginkgo.GinkgoRecover
	GinkgoT                               = ginkgo.GinkgoT
	RunSpecs                              = ginkgo.RunSpecs
	RunSpecsWithCustomReporters           = ginkgo.RunSpecsWithCustomReporters
	RunSpecsWithDefaultAndCustomReporters = ginkgo.RunSpecsWithDefaultAndCustomReporters
	GinkgoWriter                          = NewWriter(ginkgo.GinkgoWriter)
)

Functions

func AfterAll

func AfterAll(body func()) bool

AfterAll runs the function once after any test in context

func AfterEach

func AfterEach(body func(), timeout ...float64) bool

AfterEach runs the function after each test in context

func AfterFailed

func AfterFailed(body func()) bool

JustAfterFailed runs the function after test and JustAfterEach if the test has failed and before all AfterEach

func BeforeAll

func BeforeAll(body func()) bool

BeforeAll runs the function once before any test in context

func BeforeEach

func BeforeEach(body interface{}, timeout ...float64) bool

BeforeEach runs the function before each test in context

func By

func By(message string, optionalValues ...interface{})

By allows you to better document large Its.

Generally you should try to keep your Its short and to the point. This is not always possible, however, especially in the context of integration tests that capture a particular workflow.

By allows you to document such flows. By must be called within a runnable node (It, BeforeEach, Measure, etc...) By will simply log the passed in text to the GinkgoWriter.

func FailWithToggle

func FailWithToggle(message string, callerSkip ...int)

FailWithToggle wraps `ginkgo.Fail` function to have a option to disable the panic when something fails when is running on AfterEach.

func GetTestName

func GetTestName() string

GetTestName returns the test Name in a single string without spaces or /

func GinkgoPrint

func GinkgoPrint(message string, optionalValues ...interface{})

GinkgoPrint send the given message to the test writers to store it.

func JustAfterEach

func JustAfterEach(body func()) bool

JustAfterEach runs the function just after each test, before all AfterEeach, AfterFailed and AfterAll

func RunAfterEach

func RunAfterEach(cs *scope)

RunAfterEach is a wrapper that executes all AfterEach functions that are stored in cs.afterEach array.

Types

type Done

type Done ginkgo.Done

type JUnitFailureMessage

type JUnitFailureMessage struct {
	Type    string `xml:"type,attr"`
	Message string `xml:",chardata"`
}

JUnitFailureMessage failure message struct

type JUnitReporter

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

JUnitReporter struct that uses ginkgo to report

func NewJUnitReporter

func NewJUnitReporter(filename string) *JUnitReporter

NewJUnitReporter creates a new JUnit XML reporter. The XML will be stored in the passed in filename.

func (*JUnitReporter) AfterSuiteDidRun

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

AfterSuiteDidRun ginkgo.Aftersuite report function

func (*JUnitReporter) BeforeSuiteDidRun

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

BeforeSuiteDidRun Beforesuite report function

func (*JUnitReporter) SpecDidComplete

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

SpecDidComplete reports the test results in a JUTestCase struct

func (*JUnitReporter) SpecSuiteDidEnd

func (reporter *JUnitReporter) SpecSuiteDidEnd(summary *types.SuiteSummary)

SpecSuiteDidEnd summary information to Suite summary in the xml report

func (*JUnitReporter) SpecSuiteWillBegin

func (reporter *JUnitReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary)

SpecSuiteWillBegin create the main JUnitTestSuite based on Ginkgo parameters

func (*JUnitReporter) SpecWillRun

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

SpecWillRun needed by ginkgo. Not used.

type JUnitSkipped

type JUnitSkipped struct {
	XMLName xml.Name `xml:"skipped"`
}

JUnitSkipped skipped struct to report XML

type JUnitTestCase

type JUnitTestCase struct {
	Name           string               `xml:"name,attr"`
	ClassName      string               `xml:"classname,attr"`
	FailureMessage *JUnitFailureMessage `xml:"failure,omitempty"`
	Skipped        *JUnitSkipped        `xml:"skipped,omitempty"`
	Time           float64              `xml:"time,attr"`
	SystemErr      string               `xml:"system-err,omitempty"`
	SystemOut      string               `xml:"system-out,omitempty"`
}

JUnitTestCase test case struct to report in Junit Format.

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName   xml.Name        `xml:"testsuite"`
	TestCases []JUnitTestCase `xml:"testcase"`
	Name      string          `xml:"name,attr"`
	Tests     int             `xml:"tests,attr"`
	Failures  int             `xml:"failures,attr"`
	Errors    int             `xml:"errors,attr"`
	Time      float64         `xml:"time,attr"`
}

JUnitTestSuite main struct to report all test in Junit Format

type Writer

type Writer struct {
	Buffer *bytes.Buffer
	// contains filtered or unexported fields
}

A Writer is a struct that has a variable-sized `bytes.Buffer` and one outWriter(`io.writer`) to stream data

func NewWriter

func NewWriter(outWriter io.Writer) *Writer

NewWriter creates and initializes a Writer with a empty Buffer and the given outWriter

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

Bytes returns a slice based on buffer.Bytes()

func (*Writer) Reset

func (w *Writer) Reset()

Reset resets the buffer to be empty,

func (*Writer) Write

func (w *Writer) Write(b []byte) (n int, err error)

Write appends the contents of b to the buffer and outWriter, growing the buffer as needed. The return value n is the length of p; err is always nil. If the buffer becomes too large, Write will panic with ErrTooLarge.

Jump to

Keyboard shortcuts

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