features

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 32

Documentation

Overview

Package features hosts types that are used to define a feature tests and other related types.

Index

Constants

View Source
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

func FilterStepsByName(steps []types.Step, regexName *regexp.Regexp) []types.Step

func GetStepsByLevel

func GetStepsByLevel(steps []types.Step, l types.Level) []types.Step

Types

type Feature

type Feature = types.Feature

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 Func

type Func = types.StepFunc

type Labels

type Labels = types.Labels

type Level

type Level = types.Level

type Step

type Step = types.Step

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.

type TableRow added in v0.4.0

type TableRow struct {
	Name        string
	Description string
	Assessment  Func
}

Jump to

Keyboard shortcuts

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