Search code examples
asp.netwebratweb-testing

Can I use Webrat for ASP.NET applications?


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.


Solution

  • 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).