eventlis

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package eventlis provides an API to attach listeners that are called at events during the test execution.

Code can register a callback to be invoked after the reservation is complete but before any tests are executed by calling EventListener.AddBeforeTestsCallback:

ondatra.EventListener().AddBeforeTestsCallback(func (e *eventlis.BeforeTestsEvent) {
	handleBeforeTestsEvent(e)
})

Code can register a callback to be invoked after all the tests are complete but before the reservation is released by calling EventListener.AddAfterTestsCallback:

ondatra.EventListener().AddAfterTestsCallback(func (e *eventlis.AfterTestsEvent) {
	handleAfterTestsEvent(e)
})

These calls can be made from the test itself, from the binding, or from a helper library that the test imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterTestsEvent

type AfterTestsEvent struct {
	ExitCode *int
}

AfterTestsEvent occurs after the tests are finished executing and before the reservation is released.

type BeforeTestsEvent

type BeforeTestsEvent struct {
	Reservation *binding.Reservation
}

BeforeTestsEvent occurs after the reservation is complete and before tests start executing.

type EventListener

type EventListener struct{}

EventListener is an event listener API.

func (*EventListener) AddAfterTestsCallback

func (el *EventListener) AddAfterTestsCallback(cb func(*AfterTestsEvent) error)

AddAfterTestsCallback adds a callback to run after the tests are finished executing and before the reservation is released.

func (*EventListener) AddBeforeTestsCallback

func (el *EventListener) AddBeforeTestsCallback(cb func(*BeforeTestsEvent) error)

AddBeforeTestsCallback adds a callback to run after the reservation is complete and before tests start executing.

Jump to

Keyboard shortcuts

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