JavaScript / Selenium Testing in Ruby on Rails

My buddy Gabriel links to JTF — JavaScript unit Testing Farm.

How does it work? From the site:

You write your javascript and insert some code to indicate a failure (or a pass) using the same functions as in JsUnit and other unit testing frameworks. Then, every time a visitor views your test case, it performs the unit test on their browser… providing information if the test fails.

Sounds like a novel idea.

Over at Sprout we now have a suite of Selenium JavaScript-based acceptance tests.

It was a little tricky, but our Selenium tests for Mailroom now pass in the following browsers:
- IE6 on XP
- Firefox on XP
- Firefox on OS X
- Safari on OS X

The first thing Charles asked me was… if we already have Unit & Functional tests already, why do we need Selenium ones too?

Granted, Selenium tests are not necessary for a small startup. But at previous employers, full-time Testers have been employed whose sole job was to:
- sit around for 4-5 days a week (waiting for a new release)
- if the developers happened to have a new release ready by Friday, the Testers would jump into action and earn their $37k a year in one afternoon per week.

Many lessons can be learned from this anecdote, but one is: hire someone who can automate away his or her own job in a few weeks and move onto things that cannot be automated.

Writing Selenium Tests in Rails

Often I feel the urge to simply create a new Selenium test for a new feature that we implement. There’s nothing like a full UI-based end-to-end test to see if something is functioning properly. (this could just be a psychological phenomena)

But, we also add Unit & Functional tests, and then sometimes maybe Selenium tests. That’s some pretty good code coverage. :)

Selenium on Rails Links

Selenium on Rails Plugin (Recommended)

Automate Acceptance Tests with Selenium

There is an alternative Selenium on Rails plugin floating around that comes up a lot higher in Google searches.

It’s sad because the devs on this other plugin did a tremendous job at marketing (and developing) their plugin, but I am not as impressed with it as the one mentioned above. Here’s a link, which includes a nice screencast:
Selenium on Rails Plugin

Screencasts are the *ultimate* linkbait! I needs to make me some of dem!

You can Bookmark this entry on del.icio.usbookmark this, digg this entrydigg this or check the See this page in technoraticosmos

2 Responses to “JavaScript / Selenium Testing in Ruby on Rails”

  1. Gravatar Icon 1 Jason Huggins 

    Hiya, I’m under contract to write a book on Selenium and am looking for a few case studies. It would be great if I could chat with you sometime about your experiences, especially the little “if I knew then, what I knew now” things, tips, tricks, gotchas, etc…. Contact me via email– s e l e n i u m @ j r a n d o l p h . c o m (no spaces)…

    Thanks
    Jason Huggins
    Developer, The Selenium Project

  2. Gravatar Icon 2 Jason Huggins 

    Hi, I’m under contract to write a book on Selenium and am looking for a few case-studies. I’m especially interested on those tips, tricks, gotchas, and lessons learned that only come from experience. Contact me s e l e n i u m @ j r a n d o l p h . c o m (no spaces)

    Thanks!
    Jason Huggins,
    The Selenium Project


Shanti A. Braford blogs here.

If you really want to know, just read this.



  

Powered by FeedBlitz