Describe the solution you'd like
We discussed in #65 that we want some kind of way of writing less test code.
My idea is to add markers to functions which define the step definition. The first words should be GoBDD step: and after that, there should be a regular expression. Example:
// +gobdd-step: I add (\d+) and (\d+)
func add(ctx context.Context, var1, var2 int) error {
...
}
After calling command gobdd configure generate the command will output a new function definition.
func ConfigureSteps(suite *gobdd.Suite) {
suite.AddStep(add, `I add (\d+) and (\d+)`)
// other steps will go here
}
It will be copy&paste ready peace of code. If you provide the -f output.go parameter, the command will parse the output.go code:
- if there's no
ConfigureSteps func, it will add it as the very last function in the file
- if it exists - it will replace its body.
Describe the solution you'd like
We discussed in #65 that we want some kind of way of writing less test code.
My idea is to add markers to functions which define the step definition. The first words should be
GoBDD step:and after that, there should be a regular expression. Example:After calling command
gobdd configure generatethe command will output a new function definition.It will be copy&paste ready peace of code. If you provide the
-f output.goparameter, the command will parse theoutput.gocode:ConfigureStepsfunc, it will add it as the very last function in the file