The Issue
We would like to check the basic integrity of Cucumber step definitions.
- Are they all defined?
- Are any duplicated or ambiguous?
The Answer
Use the Cucumber ‘–dry-run’ argument.
1 |
cucumber features\hard_code.feature --dry-run -f html -o ./hard_code.html |
In the HTML report Cucumber will indicate undefined steps and suggest a step definition returning ‘pending’. Duplicate or ambiguous step definitions will also be shown with all possible step definitions and their locations.
If you want to see it in the console add ‘-f pretty’ or don’t specify any format.

The ambigious cucumber match is causing an error in our script.
The suggested definitions for those undefined appear at the end of the output.
The Result
You are left with a quick, easy way to do a sanity check on your Cucumber Ruby Webdriver step definitions. If you are trying to debug a test script, check out our post on using binding.pry for debugging purposes.