[rspec-users] webrat the way to go?

aslak hellesoy aslak.hellesoy at gmail.com
Wed Sep 24 16:03:54 EDT 2008

On Wed, Sep 24, 2008 at 9:43 PM, Fernando Perez <lists at ruby-forum.com> wrote:
> I'd like to know: in a nutshell what's the difference between Webrat and
> Cucumber?

They do completely different things.

Webrat is a library that allows you to interact with a Rails web app
using a high level API similar to Watir and Selenium, but without the
overhead of HTTP and a browser. In essence: go to this URL, fill in
that field, click that button, follow that link. That sort of thing.
It's a library with a fairly small set of methods that you can call.

Cucumber has nothing to do with Rails, webapps or Webrat for that
matter (although you can use them together). Cucumber lets you write
high level narratives of interactions between a person and a computer
system in plain text, without knowledge of Ruby. Think of it as
executable documentation/requirements. It also provides ruby
programmers with "glue" that sits between these plain text scenarios
and your app. In this "glue" (steps we call them) you can use whatever
ruby libraries you want. For example Webrat. Or something else.

It just happens that Cucumber+Webrat is a real nice blend if you
happen to be writing a Rails app (if you're writing a ruby app that is
not Rails, Cucumber would still work well, but Webrat wouldn't). Kind
of like ham and eggs. But you don't *have* to have egs with ham or
vice versa. Please - no chunky bacon jokes!


> I saw that in RSpec 1.1.5, Story Runner will be replaced by Cucumber, so
> isn't learning Cucumber compulsory?
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list