Cucumber Tip: Key-Value Tables
You may not realize this: Tables in Cucumber steps don't have to have a header row. Sometimes it can work really well to use a headerless table of key-value pairs. Let's look at an example. Suppose we have a scenario that fills out an advanced search form to search for medical providers matching certain criteria. A mockup of the form looks something like this: If we were using the recently deprecated web steps generated by cucumber-rails, we might write steps to perform a search like these: Given I'm on the advanced search page And I select "Endocrinology" from "Specialty" And I choose "Yes" within "Accepts Insurance" And I fill in "ZIP Code" with "90010" And I select "5 miles" from "Search Radius" When I press "Search" But we know better than to do that, right? After all, we're trying to describe how the search logic should work, not how the form should look. Read More