Search code examples
rubycucumberbdd

Calling step in step definitons


I'm trying to call a step that takes an argument in an another step definitions but i'm getting an error like

Cucumber::UndefinedDynamicStep: Undefined dynamic step: "And user select Electronics as category group from dropdown list"

.feature file
And   user fill the create new category form "Electronics"

.rb file
And(/^user fill the create new category form "([^"]*)"$/) do |name|
    step "And user type name #{name}"

And(/^user type name "([^"]*)"$/) do |name|
  find(:id, 'namePanelGroup').set(name)
end

How can i handle with this situation?


Solution

  • You need to add escaped double quotes because the step you are calling has double quotes around the regex, and you need to remove the "And" like so:

    step "user type name \"#{name}\""