types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DescribableFeature

type DescribableFeature interface {
	Feature

	// Description is used to provide a readable context for the test feature. This can be used
	// to provide more context for the test being performed and the assessment under each of the
	// feature.
	Description() string
}

type DescribableStep

type DescribableStep interface {
	Step
	// Description is the Readable test description indicating the purpose behind the test that
	// can add more context to the test under question
	Description() string
}

type EnvFunc

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

EnvFunc represents a user-defined operation that can be used to customize 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) context.Context

	// 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) context.Context

	// 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

	// EnvConf returns the test environment's environment configuration
	EnvConf() *envconf.Config
}

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

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

FeatureEnvFunc represents a user-defined operation that can be used to customize 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

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

TestEnvFunc represents a user-defined operation that can be used to customize 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