Bryan Says...

Rants, opinions, and other stuff I find interesting.

Cucumber – Your Ruby Acceptance Tool of Choice?

I’ve spent a lot of time in Cucumber lately. Mostly because I’ve been trying to integrate it into my daily workflow and also because I’ve given two presentations on it this month. I have come to a conclusion about it, and that conclusion is that I’m not a 100% convert.

Cucumber has lots of good things going for it. I really like the DSL. Given/When/Then is easy to share with coders and non-coders alike. The required nomenclature for a feature is nice when you are looking for the context of a particular feature.

Something is just not clicking for me. I can’t put my figure on it, but something is telling me not to like Cucumber.

Most of the development I’m doing these days is Ruby on Rails based. Rails comes with a so-called “integration” mechanism which is analogous to Cucumber in many respects. Both have pretty good webrat integration. Both allow you to use sweet DSLs to make everything look nice. But Rails integration tests have one benefit — they are built in. That means a lot to me at least.

To be fair, Cucumber has lots of things going for it. Tagging is looking pretty awesome, and it doesn’t appear that the guys working on it are going to slow down any time soon.

So, what does this mean for me? I’ll most likely keep a close eye on Cucumber because it works for more than just Rails at the moment.

What Cucumber really needs is a way to easily build stories. Right now, it is chore to keep track of exactly how steps are defined versus how they are actually used. It would also be nice to have a tool that showed a graphical representation of your stories, and allowed easy access to arbitrary scenarios. Maybe someone should work on that?

  • http://benmabey.com Ben Mabey

    “Right now, it is chore to keep track of exactly how steps are defined versus how they are actually used.”

    Have you tried using the usage formatter? It will tell you what steps are being used and where from. It won't however tell you what isn't being used.. Please add a ticket if you think that would help. However, you can already easily tell what steps are not being used by running RCov and see which steps are red. Thats probably more labor intensive that you would like, but writing a script to parse the report wouldn't be too difficult I'd imagine.

    “It would also be nice to have a tool that showed a graphical representation of your stories, and allowed easy access to arbitrary scenarios. Maybe someone should work on that?”

    There are also a number of tools in the works for a better way to display your current features for a project. Namely Rcumber and cucumber-skin. I'm sure there are more as well that haven't come on my radar yet. Now that cucumber 0.2.0 is out I think the plan is to focus more on an API that will allow for tools such as these to easily integrate any viewer/editor that people want to build. The end goal of these being a place where stakeholders can quickly view/edit/create/run features and scenarios.

  • aslakhellesoy

    The usage formatter will also report unused step definitions:
    http://github.com/aslakhellesoy/cucumber/commit

    The Cucumber TextMate bundle isn't using this (yet), but it already has decent auto completion for features. Other editors/IDEs will hopefully use the usage formatter to make feature authoring easier.

  • scottmotte

    I tried out Cucumber a bit myself and felt it was too much effort for my needs. Checkout Merb's request method. I think you'd really like it Bryan.

    Here's a good overview on the differences and effectiveness: http://atmos.org/index.php/2008/11/29/merb-10-c

    I believe Yehuda Katz pioneered it, and it really seems the way to go.

  • deedubs

    Yeah I've been thinking of making a story builder. It would be awesome for your project manager to be able to create a story using a simple interface and have it added to your git repo.

    Dreams.

  • http://finitestatemachine.com Toby Hede

    I have been using Cucumber and have much the same reaction … if you live in a world where your Business-level people can define stories – well, that would make sense to me. Otherwise it seems like a whole extra level sitting on top of the actual integration code.

  • http://infochimps.org Philip (flip) Kromer

    Take a look at pickler (http://github.com/tpope/pickler/tree/master). It integrates cucumber with PivotalTracker: you can file a story in pivotal tracker, flesh it out on the dev side, and keep your progress integrated in the project management tracking.

    As for “seeing” your tests, there are a couple tools on GitHub to PDFify you user stories — http://github.com/danlucraft/features_reports and http://github.com/brynary/features2cards I haven't played with them, only bookmarked them, so YMMV. PivotalTracker has some nice reporting built in too of course. Lastly I'm hearing good things about Integrity for CI testing. None of these handle the editor integration you're looking for, though.

  • http://www.adslviettel.com adsl viettel

    Yes, There are many tools in the works for a better way to display your current features for a project. Nice writing. You are on my RSS reader now so I can read more from you down the road. I have just given it a Digg.