- Having a separate test framework is annoying
- Mapping steps to regexps is hard
- Cucumber has a huge, messy codebase
- Steps are always global
I don’t really care about having a Cucumber test framework as I don’t often use RSpec, I actually find regexen quite powerful, I also don’t really care about Cucumber’s code base but I can see some merit in having scoped steps.
I converted my existing demo test suite across to use Turnip and this is what I found.
Turnip follows Spinach in trying to move away from using regular expressions to define steps. Fortunately, unlike Spinach, Turnip allows you to capture values using placeholders in your steps (this was an instant NO to using Spinach):
step "I should see at least :exp_num_results results" do |exp_num_results| on :results do |page| page.number_search_results.should >= exp_num_results.to_i end end
Unfortunately there are a number of limitations to this approach:
- You can’t capture more than a single word in a placeholder without using double quotes in your feature file – making them less readable; and
- You can’t capture values like “100,000” as it doesn’t appear to support special characters in placeholders.
You can also do some magic using custom step placeholders, where you define regular expressions, but to me that kinda defeats the point of not using regexen in the first place.
The scoped steps are quite neat and ruby like, and I can see these being very useful for large projects where multiple people are writing the steps.
Running Turnip files is as simple as using the RSpec test runner, but unfortunately the output of pending steps is less useful than Cucumber in that there are no code snippets, and only the first undefined step is displayed as undefined (unlike the Cucumber which shows you every step that is undefined).
I like the approach that Turnip takes in being a simple way to write business like tests and run them using RSpec. Unfortunately that simplicity comes at a price, and losing the power of regexen in step definitions is not something I would like to give up hastily. I am hoping that the scoped steps someday make their way into the Cucumber code base.