My cucumber obsession continues unabated. I’ve spent a lot of the last week adding Cucumber to projects, writing about it in a very long section for the Rails Test Prescriptions book, and generally trying to figure out how to use this tool, not to mention trying to figure out why this tool has been so interesting to me this week.
Some follow-up thoughts since last week’s post.
- I’m really excited about the idea of using Cucumber as a way to bootstrap testing on a legacy project that has no tests. The normal problem is that you need to refactor in order to write good tests, but since you don’t have good tests, you have no way to prove that your refactor didn’t break anything. Cucumber’s advantage here is that it can treat the Rails application as a black box, so you can throw in some Cucumber tests without touching the original code. This will give you some trip wires that will let you know if something gets really broken in your refactor. Plus, it’s a good way to learn your way around an unfamiliar project.
- For what it’s worth, I seem to be getting a fair amount of reuse out of step definitions within the same feature. That is, after I’ve set up most of the baseline scenarios, if I think of a new oddball one, most of the steps that make it up are already defined.
- After pointing out last week that my first real Cucumber example actually passed in Cucumber after failing in the browser, I need to mention that this week I had a big Cucumber success, where my unit tests passed, but the browser and Cucumber didn’t behave correctly. In this case, the unit test was performing operations in a different order then the browser code, and created a false pass.
- I’m not completely sure why, or even whether I’ll feel this way in a few days, but Cucumber view tests feel much more readable than pure Test::Unit view tests, even with the indirection of the step definition. Even if Cucumber was just a DSL for creating readable view tests, I still think it’d be useful.
- I don’t think there’s a definitive sense of what great Cucumber style is, but, at the moment, I’m skeptical of the advantages of bundling Cucumber steps into the step definitions. I appreciate the advantages of reducing duplication, but I think that Cucumber is most valuable if the actual feature page is as open and accessible as possible. I’d rather have more steps in Cucumber with short definitions than fewer steps and more complex definitions.


[...] Agile Ajax » Again With The Cucumbers » Pathfinder Development [...]
[...] been about ten weeks since I wrote about Cucumber the first time and the second time. Since then, I’ve continued to use Cucumber and now seemed like a good time to update some thoughts [...]