types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvFunc

type EnvFunc func(context.Context, *envconf.Config) (context.Context, error)

EnvFunc represents a user-defined operation that can be used to customized the behavior of the environment. Changes to context are expected to surface to caller.

type Environment

type Environment interface {
	// WithContext returns a new Environment with a new context
	WithContext(context.Context) Environment

	// Setup registers environment operations that are executed once
	// prior to the environment being ready and prior to any test.
	Setup(...EnvFunc) Environment

	// BeforeEachTest registers environment funcs that are executed
	// before each Env.Test(...)
	BeforeEachTest(...TestEnvFunc) Environment

	// BeforeEachFeature registers step functions that are executed
	// before each Feature is tested during env.Test call.
	BeforeEachFeature(...FeatureEnvFunc) Environment

	// AfterEachFeature registers step functions that are executed
	// after each feature is tested during an env.Test call.
	AfterEachFeature(...FeatureEnvFunc) Environment

	// Test executes a test feature defined in a TestXXX function
	// This method surfaces context for further updates.
	Test(*testing.T, ...Feature)

	// TestInParallel executes a series of test features defined in a
	// TestXXX function in parallel. This works the same way Test method
	// does with the caveat that the features will all be run in parallel
	TestInParallel(*testing.T, ...Feature)

	// AfterEachTest registers environment funcs that are executed
	// after each Env.Test(...).
	AfterEachTest(...TestEnvFunc) Environment

	// Finish registers funcs that are executed at the end of the
	// test suite.
	Finish(...EnvFunc) Environment

	// Run Launches the test suite from within a TestMain
	Run(*testing.M) int
}

Environment represents an environment where features can be tested.

type Feature

type Feature interface {
	// Name is a descriptive text for the feature
	Name() string
	// Labels returns a map of feature labels
	Labels() Labels
	// Steps testing tasks to test the feature
	Steps() []Step
}

type FeatureEnvFunc added in v0.0.4

type FeatureEnvFunc func(context.Context, *envconf.Config, *testing.T, Feature) (context.Context, error)

FeatureEnvFunc represents a user-defined operation that can be used to customized the behavior of the environment. Changes to context are expected to surface to caller. Meant for use with before/after feature hooks. *testing.T is provided in order to provide pass/fail context to features.

type Labels

type Labels = flags.LabelsMap

type Level

type Level uint8
const (
	// LevelSetup when doing the setup phase
	LevelSetup Level = iota
	// LevelAssess when doing the assess phase
	LevelAssess
	// LevelTeardown when doing the teardown phase
	LevelTeardown
)

type Step

type Step interface {
	// Name is the step name
	Name() string
	// Level action level {setup|requirement|assertion|teardown}
	Level() Level
	// Func is the operation for the step
	Func() StepFunc
}

type StepFunc

type StepFunc func(context.Context, *testing.T, *envconf.Config) context.Context

type TestEnvFunc added in v0.0.4

type TestEnvFunc func(context.Context, *envconf.Config, *testing.T) (context.Context, error)

TestEnvFunc represents a user-defined operation that can be used to customized the behavior of the environment. Changes to context are expected to surface to caller. Meant for use with before/after test hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳