Documentation ¶
Overview ¶
Code generated .* DO NOT EDIT.
This project is created as the alternative to https://github.com/DATA-DOG/godog and is inspirited by it. There are a few differences between both solutions:
- GoBDD uses the built-in testing framework
- GoBDD is run as standard test case (not a separate program)
- you can use every Go native feature like build tags, pprof and so on
- the context in every test case contains all the required information to run (values passed from previous steps). More information can be found in the readme file https://github.com/go-bdd/gobdd/blob/master/README.md
Index ¶
- func RunInParallel() func(*SuiteOptions)
- func WithAfterScenario(f func(ctx Context)) func(*SuiteOptions)
- func WithAfterStep(f func(ctx Context)) func(*SuiteOptions)
- func WithBeforeScenario(f func(ctx Context)) func(*SuiteOptions)
- func WithBeforeStep(f func(ctx Context)) func(*SuiteOptions)
- func WithFeaturesPath(path string) func(*SuiteOptions)
- func WithIgnoredTags(tags []string) func(*SuiteOptions)
- func WithTags(tags []string) func(*SuiteOptions)
- type Context
- func (ctx Context) Clone() Context
- func (ctx Context) Get(key interface{}, defaultValue ...interface{}) (interface{}, error)
- func (ctx Context) GetAs(key interface{}, dest interface{}) error
- func (ctx Context) GetBool(key interface{}, defaultValue ...bool) (bool, error)
- func (ctx Context) GetError(key interface{}, defaultValue ...error) (error, error)
- func (ctx Context) GetFloat32(key interface{}, defaultValue ...float32) (float32, error)
- func (ctx Context) GetFloat64(key interface{}, defaultValue ...float64) (float64, error)
- func (ctx Context) GetInt(key interface{}, defaultValue ...int) (int, error)
- func (ctx Context) GetInt16(key interface{}, defaultValue ...int16) (int16, error)
- func (ctx Context) GetInt32(key interface{}, defaultValue ...int32) (int32, error)
- func (ctx Context) GetInt64(key interface{}, defaultValue ...int64) (int64, error)
- func (ctx Context) GetInt8(key interface{}, defaultValue ...int8) (int8, error)
- func (ctx Context) GetString(key interface{}, defaultValue ...string) (string, error)
- func (ctx Context) Set(key interface{}, value interface{})
- type StepTest
- type Suite
- type SuiteOptions
- type TestingT
- type TestingTKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunInParallel ¶ added in v0.7.0
func RunInParallel() func(*SuiteOptions)
RunInParallel runs tests in parallel
func WithAfterScenario ¶ added in v0.7.0
func WithAfterScenario(f func(ctx Context)) func(*SuiteOptions)
WithAfterScenario configures functions that should be executed after every scenario
func WithAfterStep ¶ added in v1.1.2
func WithAfterStep(f func(ctx Context)) func(*SuiteOptions)
WithAfterStep configures functions that should be executed after every step
func WithBeforeScenario ¶ added in v0.7.0
func WithBeforeScenario(f func(ctx Context)) func(*SuiteOptions)
WithBeforeScenario configures functions that should be executed before every scenario
func WithBeforeStep ¶ added in v1.1.2
func WithBeforeStep(f func(ctx Context)) func(*SuiteOptions)
WithBeforeStep configures functions that should be executed before every step
func WithFeaturesPath ¶ added in v0.7.0
func WithFeaturesPath(path string) func(*SuiteOptions)
WithFeaturesPath configures a pattern (regexp) where feature can be found. The default value is "features/*.feature"
func WithIgnoredTags ¶ added in v0.7.0
func WithIgnoredTags(tags []string) func(*SuiteOptions)
WithIgnoredTags configures which tags should be skipped while executing a suite Every tag has to start with @ otherwise will be ignored
func WithTags ¶ added in v0.7.0
func WithTags(tags []string) func(*SuiteOptions)
WithTags configures which tags should be skipped while executing a suite Every tag has to start with @
Types ¶
type Context ¶ added in v1.0.1
type Context struct {
// contains filtered or unexported fields
}
Holds data from previously executed steps
func (Context) Get ¶ added in v1.0.1
Returns the data under the key. If couldn't find anything but the default value is provided, returns the default value. Otherwise, it returns an error.
func (Context) GetAs ¶ added in v1.1.3
GetAs copies data from tke key to the dest. Supports maps, slices and structs.
func (Context) GetError ¶ added in v1.0.1
It is a shortcut for getting the value already casted as error.
func (Context) GetFloat32 ¶ added in v1.0.1
func (Context) GetFloat64 ¶ added in v1.0.1
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
Suite holds all the information about the suite (options, steps to execute etc)
func NewSuite ¶
func NewSuite(t TestingT, optionClosures ...func(*SuiteOptions)) *Suite
Creates a new suites with given configuration and empty steps defined
func (*Suite) AddParameterTypes ¶ added in v1.1.0
AddParameterTypes adds a list of parameter types that will be used to simplify step definitions.
The first argument is the parameter type and the second parameter is a list of regular expressions that should replace the parameter type.
s.AddParameterTypes(`{int}`, []string{`(\d)`})
The regular expression should compile, otherwise will produce an error and stop executing.
func (*Suite) AddRegexStep ¶ added in v0.6.0
AddRegexStep registers a step in the suite.
The second parameter is the step function that gets executed when a step definition matches the provided regular expression.
A step function can have any number of parameters (even zero), but it MUST accept a gobdd.StepTest and gobdd.Context as the first parameters (if there is any):
func myStepFunction(t gobdd.StepTest, ctx gobdd.Context, first int, second int) { }
func (*Suite) AddStep ¶
AddStep registers a step in the suite.
The second parameter is the step function that gets executed when a step definition matches the provided regular expression.
A step function can have any number of parameters (even zero), but it MUST accept a gobdd.StepTest and gobdd.Context as the first parameters (if there is any):
func myStepFunction(t gobdd.StepTest, ctx gobdd.Context, first int, second int) { }
type SuiteOptions ¶
type SuiteOptions struct {
// contains filtered or unexported fields
}
SuiteOptions holds all the information about how the suite or features/steps should be configured
func NewSuiteOptions ¶
func NewSuiteOptions() SuiteOptions
NewSuiteOptions creates a new suite configuration with default values
type TestingTKey ¶ added in v1.1.2
type TestingTKey struct{}
TestingTKey is used to store reference to current *testing.T instance