Documentation ¶
Overview ¶
Package elicit is a native go BDD testing framework using markdown for executable specifications
Index ¶
- type Context
- func (ctx *Context) AfterScenarios(hook Hook) *Context
- func (ctx *Context) AfterSpecs(hook Hook) *Context
- func (ctx *Context) AfterSteps(hook Hook) *Context
- func (ctx *Context) BeforeScenarios(hook Hook) *Context
- func (ctx *Context) BeforeSpecs(hook Hook) *Context
- func (ctx *Context) BeforeSteps(hook Hook) *Context
- func (ctx *Context) RunTests(ctxT *testing.T) *Context
- func (ctx *Context) WithSpecsFolder(path string) *Context
- func (ctx *Context) WithSteps(steps Steps) *Context
- func (ctx *Context) WithTransforms(txs Transforms) *Context
- type Hook
- type Hooks
- type Steps
- type Table
- type TextBlock
- type Transforms
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context stores test machinery and maintains state between specs/scenarios/steps
func New ¶
func New() *Context
New creates a new elicit context which stores specs, steps and transforms
func (*Context) AfterScenarios ¶
AfterScenarios registers a function to be called after each scenario
func (*Context) AfterSpecs ¶
AfterSpecs registers a function to be called after each spec
func (*Context) AfterSteps ¶
AfterSteps registers a function to be called after each step
func (*Context) BeforeScenarios ¶
BeforeScenarios registers a function to be called before each scenario
func (*Context) BeforeSpecs ¶
BeforeSpecs registers a function to be called before each spec
func (*Context) BeforeSteps ¶
BeforeSteps registers a function to be called before each step
func (*Context) WithSpecsFolder ¶
WithSpecsFolder recursively adds the path to the discovery path of specs
func (*Context) WithSteps ¶
WithSteps registers steps from the supplied map of patterns to functions
func (*Context) WithTransforms ¶
func (ctx *Context) WithTransforms(txs Transforms) *Context
WithTransforms registers step argument transforms from the suppled map of patterns to functions
type Hook ¶
type Hook func()
Hook is a function which can be registered to execute before/after each spec/scenario/step
type Steps ¶
type Steps map[string]interface{}
Steps are used to register step implemenations against regex patterns The key must successfully compile to a regexp.Regexp and the values must be functions obeying the semantics of a step implementation. Step Implementations are of the form: func(t *testing.T, param string) {} The number of additional parameters should match the number of subgroups in the pattern used as a key.
type Transforms ¶
type Transforms map[string]interface{}
Transforms are used to register functions which can convert strings captured by steps into the types expected by the step implementation. The string is a pattern which captured subgroups must match for the transform to be considered.