suitetest

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookOrderPackage int = -0xffff
)

Variables

This section is empty.

Functions

func RunTests

func RunTests(m *testing.M, opts ...PackageOptions)

Types

type PackageHook

type PackageHook interface {
	Setup() error
	Teardown() error
}

type PackageOptions

type PackageOptions func(opt *pkg)

func Setup

func Setup(fn SetupFunc) PackageOptions

Setup register the given setup function to run at order 0, higher(smaller) order runs first package setup runs once per test package, and should only be registered in TestMain(m *testing.M)

func SetupWithOrder

func SetupWithOrder(order int, fn SetupFunc) PackageOptions

SetupWithOrder register the given setup function to run at given order, higher(smaller) order runs first package setup runs once per test package, and should only be registered in TestMain(m *testing.M)

func Teardown

func Teardown(fn TeardownFunc) PackageOptions

Teardown register the given teardown function to run at order 0, higher(smaller) order runs LAST package teardown runs once per test package, and should only be registered in TestMain(m *testing.M)

func TeardownWithOrder

func TeardownWithOrder(order int, fn TeardownFunc) PackageOptions

TeardownWithOrder register the given teardown function to run at given order, higher(smaller) order runs LAST package teardown runs once per test package, and should only be registered in TestMain(m *testing.M)

func TestOptions

func TestOptions(opts ...test.Options) PackageOptions

TestOptions register per-test options at package level: only declared once in TestMain(m *testing.M) All test.Options are applied once per Test*()

func TestSetup

func TestSetup(fn test.SetupFunc) PackageOptions

TestSetup is a convenient function equivalent to TestOptions(test.Setup(fn))

func TestSetupWithOrder

func TestSetupWithOrder(order int, fn test.SetupFunc) PackageOptions

TestSetupWithOrder is a convenient function equivalent to TestOptions(test.Hooks(test.NewSetupHook(order, fn)))

func TestTeardown

func TestTeardown(fn test.TeardownFunc) PackageOptions

TestTeardown is a convenient function equivalent to TestOptions(test.Teardown(fn))

func TestTeardownWithOrder

func TestTeardownWithOrder(order int, fn test.TeardownFunc) PackageOptions

TestTeardownWithOrder is a convenient function equivalent to TestOptions(test.Hooks(test.NewTeardownHook(order, fn)))

func WithOptions

func WithOptions(opts ...PackageOptions) PackageOptions

WithOptions group multiple PackageOptions into one, typically used for other test utilities to provide single entry point of certain feature. Not recommended for test implementers to use directly

type SetupFunc

type SetupFunc func() error

SetupFunc is package level setup function that run once per package

type TeardownFunc

type TeardownFunc func() error

TeardownFunc is package level teardown function that run once per package

Jump to

Keyboard shortcuts

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