Search code examples
ruby-on-railstestingmerb

Headless replacement of selenium and watir for testing Rails and Merb applications


Are there any future plans to replace selenium and watir with mechanize + johnson?

https://github.com/jbarnette/johnson/wiki

http://wiki.github.com/tenderlove/mechanize


Solution

  • For the moment, there seems to be most momentum around celerity which is a Jruby wrapper around HtmlUnit mentioned by "orip"

    Also there is a pretty neat wrapper "culerity" around celerity, which allows you to access HtmlUnit (running Java/JRuby) in your normal machine setup. Culerity is the bridge between Cucumber and Celerity.

    This is brilliant for writing tests in Cucumber, which i can highly recommend.

    Here is more info:

    http://drogomir.com/blog/2009/6/16/cucumber-and-celerity-testing-unobtrusive-javascript

    And here is the culerity examples: http://github.com/drogus/culerity-javascript-example/tree/master

    Here is the culerity project itself also with good examples (and a nice install guide) http://github.com/langalex/culerity/tree/master

    A note on maturity of this setup: I experimented with this a couple of weeks ago. And i got the culerity examples up and running fairly easy.

    On the other hand, I had problems with two things:

    • I wanted it to access my local Rails app via Webrat and ran into problems with that -- (The culerity interface to Webrat is not mature enough as of time writing).
    • The approach seemed much slower than running similar tests via Selenium (which starts a regular browser). In my example, the selenium test was about 3-4 times faster than a culerity test.

    Some of my findings may be a result of trying this out on the extreme bleeding edge. However, i still think that this will be the way, the headless browser tests will go, and apart from the immature webrat/culerity interface, you could probably create some decent test suite based on celerity/HtmlUnit :)

    I hope this answers your question.