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). 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.Context)) func(*SuiteOptions)
- func WithBeforeScenario(f func(ctx context.Context)) func(*SuiteOptions)
- func WithFeaturesPath(path string) func(*SuiteOptions)
- func WithIgnoredTags(tags []string) func(*SuiteOptions)
- func WithTags(tags []string) func(*SuiteOptions)
- type StepTest
- type Suite
- type SuiteOptions
- type TestingT
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.Context)) func(*SuiteOptions)
WithAfterScenario configures functions that should be executed after every scenario
func WithBeforeScenario ¶ added in v0.7.0
func WithBeforeScenario(f func(ctx context.Context)) func(*SuiteOptions)
WithBeforeScenario configures functions that should be executed before every scenario
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 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, optionClosures ...func(*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 gobdd.StepTest and context.Context as the first parameters (if there is any) and MUST return the context.Context back:
func myStepFunction(t gobdd.StepTest, ctx context.Context, first int, second int) context.Context {
return ctx
}
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 context.Context as the first parameters (if there is any) and MUST return the context.Context back:
func myStepFunction(t gobdd.StepTest, ctx context.Context, first int, second int) context.Context {
return ctx
}
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