Documentation
¶
Index ¶
- func Add(name string, testSetup SetupFn)
- func AddMultiStage(name string, testSetup MultiStageSetupFn)
- func AddScenario(scenario ScenarioInfo, testSetup SetupFn)
- func GetScenarioNames() []string
- type ActiveScenario
- type CancellableTimer
- type MultiStageSetupFn
- type RunFn
- type ScenarioInfo
- type ScenarioParameter
- type SetupFn
- type Stage
- type T
- type TeardownFn
- type TeardownRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMultiStage ¶
func AddMultiStage(name string, testSetup MultiStageSetupFn)
func AddScenario ¶
func AddScenario(scenario ScenarioInfo, testSetup SetupFn)
func GetScenarioNames ¶
func GetScenarioNames() []string
Types ¶
type ActiveScenario ¶
type ActiveScenario struct {
Stages []Stage
TeardownFn TeardownFn
Name string
AutoTeardownAfter time.Duration
// contains filtered or unexported fields
}
func NewActiveScenarios ¶
func NewActiveScenarios(name string, env map[string]string, fn MultiStageSetupFn, autoTeardownIdleDuration time.Duration) (*ActiveScenario, error)
func (*ActiveScenario) AutoTeardown ¶
func (s *ActiveScenario) AutoTeardown() *CancellableTimer
func (*ActiveScenario) RecordDroppedIteration ¶
func (s *ActiveScenario) RecordDroppedIteration()
func (*ActiveScenario) Run ¶
func (s *ActiveScenario) Run(metric metrics.MetricType, stage, vu, iter string, f func(t *T)) error
func (*ActiveScenario) SetAutoTeardown ¶
func (s *ActiveScenario) SetAutoTeardown(timer *CancellableTimer)
type CancellableTimer ¶
type CancellableTimer struct {
C chan bool
// contains filtered or unexported fields
}
func NewCancellableTimer ¶
func NewCancellableTimer(d time.Duration) *CancellableTimer
func (*CancellableTimer) Cancel ¶
func (c *CancellableTimer) Cancel() bool
Cancel makes all the waiters receive false
func (*CancellableTimer) Reset ¶
func (c *CancellableTimer) Reset(duration time.Duration)
type MultiStageSetupFn ¶
type MultiStageSetupFn func(t *T) ([]Stage, TeardownFn)
func GetScenario ¶
func GetScenario(scenarioName string) MultiStageSetupFn
type RunFn ¶
type RunFn func(t *T)
RunFn performs a single iteration of the test. It my be used for asserting results or failing the test.
type ScenarioInfo ¶
type ScenarioInfo struct {
Name string
Description string
Parameters []ScenarioParameter
}
type ScenarioParameter ¶
type SetupFn ¶
type SetupFn func(t *T) (RunFn, TeardownFn)
SetupFn performs any setup required to run a scenario. It returns a RunFn to be invoked for every iteration of the tests and a TeardownFn to clear down any resources after all iterations complete
func WithNoSetup ¶
type T ¶
type T struct {
// Identifier of the user for the test
VirtualUser string
// Iteration number, "setup" or "teardown"
Iteration string
// Logger with user and iteration tags
Log *log.Logger
Require *require.Assertions
Environment map[string]string
Scenario string
// contains filtered or unexported fields
}
type TeardownFn ¶
type TeardownFn RunFn
TeardownFn clears down any resources from a test run after all iterations complete.
type TeardownRegistry ¶
type TeardownRegistry struct {
// contains filtered or unexported fields
}
func NewTeardownRegistry ¶
func NewTeardownRegistry(t *T) TeardownRegistry
func (*TeardownRegistry) RegisterForTeardown ¶
func (c *TeardownRegistry) RegisterForTeardown(fn func())
func (*TeardownRegistry) RegisterForTeardownT ¶
func (c *TeardownRegistry) RegisterForTeardownT(fn func(t *T))
func (*TeardownRegistry) Teardown ¶
func (c *TeardownRegistry) Teardown(t *T)
Click to show internal directories.
Click to hide internal directories.