I have the following Scenario
defined:
Scenario: test
When test starts
Then check data with '{"age":"18","gender":"male"}'
Then try to pass {"age":"18","gender":"male"}
to the step:
func FeatureContext(s *godog.ScenarioContext) {
s.Step(`^check data with "([^']*)"$`, checkDataWith)
}
func checkDataWith(data string) error {
return godog.ErrPending
}
It says the step is not impelmented, looks like the {"age":"18","gender":"male"}
is not passed correctly, how to pass parameter like {"age":"18","gender":"male"}
to step?
This answer helped me on the other case: https://stackoverflow.com/a/19257196
In your case you can try to:
func FeatureContext(s *godog.ScenarioContext) {
s.Step(`^check data with '(.*)'$`, checkDataWith)
}
func checkDataWith(data string) error {
return godog.ErrPending
}
So the data will be passed to your scenario in the way it was in the step description:
{"age":"18","gender":"male"}