Quick Guide to Celerity

I’ll assume you already know and love Cucumber and are using it. I’ll go even farther and assume you’re writing your steps in Webrat since that’s what cucumber ships with. Now, I really like webrat. It’s a wonderful DSL and fun to work with, but it does have one problem: no javascript, no ajax.

Enter Celerity

Celerity is a headless browser for jruby that can do javascript. Now you can run your cucumber features that need to do ajax calls, and stay on the command line or CI box. It gets better though. The API is compatible with Watir, so you have the option of driving a real browser at any time. It’s not as expressive as webrat, but since you reusing cucumber steps is easy, it’s not a huge deal.

Don’t want jruby?

If you don’t want to run your whole app in jruby, checkout langalex-culerity. It’s a gem that will let you drive celerity from mri. It also comes with a common_celerity.rb file to replace most of your webrat_steps. We ran into a few steps that were missing or worked a little differently, but porting over didn’t take long at all.

That’s it!

Honestly, there’s not much to getting it working, so I’ve skipped doing a detailed step-by-step style guide. The documentation on getting jruby, celerity, and culerity installed is all you need. There weren’t any surprises. If your app has uses a fair amount of javascript, it’s worth your time to check this out.