Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeforeTestSetup ¶ added in v1.113.0
func BeforeTestSetup(f func())
BeforeTestSetup looks like a ginkgo setup node but runs the given function right away, i.e., during ginkgo's tree construction. It's sole purpose is to structure test setup code similar to BeforeEach and friends, while allowing to use the side effects when constructing further test nodes.
The primary use case is initializing `TestContext` structs that carry test state like clients, objects, etc. through common `It`s generated by helper functions. For example:
Context("Ordered test case", Ordered, func() {
var c *TestContext
BeforeTestSetup(func() {
c = NewTestContext()
})
ItShouldDoStuff(c)
})
If the `TestContext` would be initialized in a setup node like BeforeEach, the helper function receive a nil param. The only alternative is implementing an initialization method on the `TestContext`. However, sharing the context variable in multiple containers (i.e., test cases) would require zeroing the context before the initialization, which is easy to forget and might lead to surprises.
func CustomJUnitReport ¶
func CustomJUnitReport() bool
CustomJUnitReport registers a ReportAfterSuite node that writes a JUnit XML report to $ARTIFACTS/junit.xml. Specs that were interrupted by another parallel Ginkgo process due to --fail-fast are reported as skipped instead of errored, so that only the actual failure (in the other process) is visible in the report. Call this function via a top-level var in your suite file:
var _ = e2e.CustomJUnitReport()
Types ¶
This section is empty.