views:

284

answers:

2

Does Webrat require that the web application be written in Ruby/Rails?

I'd like to try it for writing tests against an ASP.NET web application.

A: 

It would be easier to jump to rails :P I stumbled upon this post because I was thinking that would be very handy.

Have a look at Cuke4Nuke

Also checkout the authors blog, there is a nice screencast but it uses WatiN

There is also some discussion here about eventually being able to build the equivalent of webrat for mvc

https://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/428-wire-protocol

Jake Scott
Thanks Jake. I've looked at Cuke4Nuke. All of my Ruby buddies use Cucumber and WebRat. I was thinking if WebRat just uses HTTP that it could work for any web site.
Randy Eppinger
Hey I just saw this as well which I think would help you test asp.net web apps http://blog.codeville.net/2009/06/11/integration-testing-your-aspnet-mvc-application/
Jake Scott
+2  A: 

You can use webrat for any application, not just Rails. What you do is to use Cucumber + Webrat + Mechanize adapter. This combination makes ordinary HTTP requests against your web application.

In fact, for the moment, i'm working on a simple smoketest that tests a website portal and can verify that everything is up and running in different environments. (localhost, test env, staging, production).

Have a look in Cucumbers' source. There is an example in the folder: cucumber/examples/webrat/

What you do is to tell Webrat to use the Mechanize adapter. Now you have a headless browser that can access any application regardless of the framework it uses.

Note that if you need full javascript support, you probably want something else (Watir,Firewatir, Selenium, etc).

Jesper Rønn-Jensen
Thanks. I was hoping that was the case. I'm trying to learn Ruby anyway so this is a great excuse to hone those skills. I hope to prove this soon and call this the answer!
Randy Eppinger
Good to hear. I just did the same thing last week, and found the example in the folder cucumber/examples/webrat folder. It's pretty straight forward, and easy as the example already has running code :)
Jesper Rønn-Jensen