One of the great things in Cucumber testing is that as you go along, you start to accumulate ready step definitions, which makes writing new tests even faster. Several times I’ve actually been surprised that a definition for a step I wrote already existed and worked as I expected it to.
However, I noticed that developers in our project were also writing duplicate step definitions, because they didn’t know the definition already existed with a different name. We defined some scenario writing guidelines and nomenclature to be used, which helped somewhat. Still, in the mass of test code it was often hard to find whether the step you needed already existed.
Things like Wally and Relish are great for converting the feature files into pretty documentation, but I couldn’t find anything similar for the step definitions themselves. So I wrote my own: cuke-steps
The script parses the step definition files and generates a single page document containing all the step definitions it finds, in a pretty-printed fashion. By clicking on any definition you can see the file and row number where the definition is and the code for the step.
Originally I wrote the script to create Confluence wiki markup. We have a Jenkins job run every night that generates the documentation and pushes it into our wiki using the Confluence Publisher Plugin. I wrote a simple HTML outputter when publishing the script. You can check out a sample output page generated from Alister Scott’s wmf-custom-page-object.
There’s still some work to be done, like prettifying the HTML output, creating a gem out of it and making it link directly to a source repo. Any updates are appreciated.