'Undefined steps in cucumber

After running my test, Cucumber says my step is undefined. Did I do something wrong?

Feature:

Then I should see Error message for "ORIGIN" zipcode with key <messageKey>

Step definition:

@Then("^I should see Error message for \"([^\"]*)\" zipcode with key ([^\\\"]*)$")
    public void i_should_see_Error_message_for_zipcode_with_key(String location, String messageKey)


Solution 1:[1]

Finally I have got the answer. Cucumber searches between feature files and step definitions character by character; so if you have too many steps sharing the same name and cucumber confuses which is which giving you "Undefined" steps with the following error, just change the name of your stepDefs. Error: "You can implement missing steps with the snippets below:"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 abbas