Documentation
¶
Overview ¶
Package features hosts types that are used to define a feature tests and other related types.
Index ¶
- Constants
- func FilterStepsByName(steps []types.Step, regexName *regexp.Regexp) []types.Step
- func GetStepsByLevel(steps []types.Step, l types.Level) []types.Step
- type Feature
- type FeatureBuilder
- func (b *FeatureBuilder) Assess(desc string, fn Func) *FeatureBuilder
- func (b *FeatureBuilder) AssessWithDescription(name, description string, fn Func) *FeatureBuilder
- func (b *FeatureBuilder) Feature() types.Feature
- func (b *FeatureBuilder) Setup(fn Func) *FeatureBuilder
- func (b *FeatureBuilder) Teardown(fn Func) *FeatureBuilder
- func (b *FeatureBuilder) WithLabel(key, value string) *FeatureBuilder
- func (b *FeatureBuilder) WithSetup(name string, fn Func) *FeatureBuilder
- func (b *FeatureBuilder) WithStep(name string, level Level, fn Func) *FeatureBuilder
- func (b *FeatureBuilder) WithStepDescription(name, description string, level Level, fn Func) *FeatureBuilder
- func (b *FeatureBuilder) WithTeardown(name string, fn Func) *FeatureBuilder
- type Func
- type Labels
- type Level
- type Step
- type Table
- type TableRow
Constants ¶
const ( // LevelSetup when doing the setup phase LevelSetup = types.LevelSetup // LevelAssess when doing the assess phase LevelAssess = types.LevelAssess // LevelTeardown when doing the teardown phase LevelTeardown = types.LevelTeardown )
Variables ¶
This section is empty.
Functions ¶
func FilterStepsByName ¶
Types ¶
type FeatureBuilder ¶
type FeatureBuilder struct {
// contains filtered or unexported fields
}
FeatureBuilder represents is a type to define a testable feature
func New ¶
func New(name string) *FeatureBuilder
func NewWithDescription ¶ added in v0.3.0
func NewWithDescription(name, description string) *FeatureBuilder
func (*FeatureBuilder) Assess ¶
func (b *FeatureBuilder) Assess(desc string, fn Func) *FeatureBuilder
Assess adds an assessment step to the feature test.
func (*FeatureBuilder) AssessWithDescription ¶ added in v0.3.0
func (b *FeatureBuilder) AssessWithDescription(name, description string, fn Func) *FeatureBuilder
func (*FeatureBuilder) Feature ¶
func (b *FeatureBuilder) Feature() types.Feature
Feature returns a feature configured by builder.
func (*FeatureBuilder) Setup ¶
func (b *FeatureBuilder) Setup(fn Func) *FeatureBuilder
Setup adds a new setup step that will be applied prior to feature test.
func (*FeatureBuilder) Teardown ¶
func (b *FeatureBuilder) Teardown(fn Func) *FeatureBuilder
Teardown adds a new teardown step that will be applied after feature test.
func (*FeatureBuilder) WithLabel ¶
func (b *FeatureBuilder) WithLabel(key, value string) *FeatureBuilder
WithLabel adds a test label key/value pair
func (*FeatureBuilder) WithSetup ¶ added in v0.0.7
func (b *FeatureBuilder) WithSetup(name string, fn Func) *FeatureBuilder
WithSetup adds a new setup step with a pre-defined setup name instead of automating the setup name generation. This can make tests more readable.
func (*FeatureBuilder) WithStep ¶ added in v0.0.4
func (b *FeatureBuilder) WithStep(name string, level Level, fn Func) *FeatureBuilder
WithStep adds a new step that will be applied prior to feature test.
func (*FeatureBuilder) WithStepDescription ¶ added in v0.3.0
func (b *FeatureBuilder) WithStepDescription(name, description string, level Level, fn Func) *FeatureBuilder
func (*FeatureBuilder) WithTeardown ¶ added in v0.0.7
func (b *FeatureBuilder) WithTeardown(name string, fn Func) *FeatureBuilder
WithTeardown adds a new teardown step with a pre-defined name instead of an auto-generated one
type Table ¶ added in v0.0.5
type Table []TableRow
Table provides a structure for table-driven tests. Each entry in the table represents an executable assessment.
func (Table) Build ¶ added in v0.0.5
func (table Table) Build(args ...string) *FeatureBuilder
Build converts the defined test steps in the table into a FeatureBuilder which can be used to add additional attributes to the feature before it's exercised. Build takes an optional feature name if omitted will be generated.