Hi,
Right now, godog does not allow to use gherkin.DocString and gherkin.DataTable with a multisteps definition.
For instance this piece of code will not work:
Then I launch the following steps:
"""
*the container @centos is running
*the container @nginx is running
"""
s.Step(`^I launch the following steps:$`,func () ILaunchTheFollowingSteps(d *gherkin.DocString) godog.Steps {
steps := strings.Split(d.Content, "*")[1:]
for i, s := range steps {
steps[i] = strings.TrimRight(s, "\n")
}
return godog.Steps(steps)
})
Godog will complain that the function ILaunchTheFollowingSteps expects one argument.
One possible way to fix this issue is to modify the method maybeUndefined :
func (s *Suite) maybeUndefined(step *gherkin.Step, text string) (undefined []string) {
def := s.matchStepText(text)
if nil == def {
undefined = append(undefined, text)
return
}
if !def.nested {
return
}
// This has been added
if def != nil && step.Argument != nil {
def.args = append(def.args, step.Argument)
}
for _, next := range def.run().(Steps) {
undefined = append(undefined, s.maybeUndefined(nil, next)...)
}
return
}
Another issue is the substeps can not have any gherkin.DocString or gherkin.Datatable.
For instance this will not work (as the step.Argument is different to the args of the StepDef):
Then I launch the following steps:
"""
*I launch a container and tag it as @centos with the options:
| type | docker|
| image | centos |
| labels | name=centos1 |
"""
Hi,
Right now, godog does not allow to use
gherkin.DocStringandgherkin.DataTablewith a multisteps definition.For instance this piece of code will not work:
Godog will complain that the function
ILaunchTheFollowingStepsexpects one argument.One possible way to fix this issue is to modify the method
maybeUndefined:Another issue is the substeps can not have any
gherkin.DocStringorgherkin.Datatable.For instance this will not work (as the step.Argument is different to the args of the
StepDef):