Documentation
¶
Overview ¶
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 or step parameters). More information can be found in the readme file https://github.com/go-bdd/gobdd/blob/master/README.md
Index ¶
- type Suite
- type SuiteOptions
- func (options SuiteOptions) RunInParallel() SuiteOptions
- func (options SuiteOptions) WithAfterScenario(f func()) SuiteOptions
- func (options SuiteOptions) WithBeforeScenario(f func()) SuiteOptions
- func (options SuiteOptions) WithFeaturesPath(path string) SuiteOptions
- func (options SuiteOptions) WithIgnoredTags(tags []string) SuiteOptions
- func (options SuiteOptions) WithTags(tags []string) SuiteOptions
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
Holds all the information about the suite (options, steps to execute etc)
func NewSuite ¶
func NewSuite(t TestingT, options SuiteOptions) *Suite
Creates a new suites with given configuration and empty steps defined
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 context.Context as the first parameter (if there is any) and MUST return a context and an error:
func myStepFunction(ctx context.Context, first int, second int) (context.Context, error) {
return ctx, nil
}
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 context.Context as the first parameter (if there is any) and MUST return a context and an error:
func myStepFunction(ctx context.Context, first int, second int) (context.Context, error) {
return ctx, nil
}
type SuiteOptions ¶
type SuiteOptions struct {
// contains filtered or unexported fields
}
Holds all the information about how the suite or features/steps should be configured
func NewSuiteOptions ¶
func NewSuiteOptions() SuiteOptions
creates a new suite configuration with default values
func (SuiteOptions) RunInParallel ¶ added in v0.6.0
func (options SuiteOptions) RunInParallel() SuiteOptions
runs tests in parallel
func (SuiteOptions) WithAfterScenario ¶ added in v0.2.0
func (options SuiteOptions) WithAfterScenario(f func()) SuiteOptions
Configures functions that should be executed after every scenario
func (SuiteOptions) WithBeforeScenario ¶ added in v0.2.0
func (options SuiteOptions) WithBeforeScenario(f func()) SuiteOptions
Configures functions that should be executed before every scenario
func (SuiteOptions) WithFeaturesPath ¶
func (options SuiteOptions) WithFeaturesPath(path string) SuiteOptions
Configures a pattern (regexp) where feature can be found. The default value is "features/*.feature"
func (SuiteOptions) WithIgnoredTags ¶
func (options SuiteOptions) WithIgnoredTags(tags []string) SuiteOptions
Configures which tags should be skipped while executing a suite Every tag has to start with @ otherwise will be ignored
func (SuiteOptions) WithTags ¶
func (options SuiteOptions) WithTags(tags []string) SuiteOptions
Configures which tags should be skipped while executing a suite Every tag has to start with @