Daniel, the problem here is testing RJS / Ajax code, which Rails Integration tests just cannot do. If you’ve never tried, you’ll very quickly find that all you get back is the javascript, and no more DOM to test. Thus most of the time your stuck with posting certain actions, refreshing the page, and asserting that the new stuff is there.
To test actual Ajax (like the opening / closing of an Add form), you need some testing library that runs a browser. Systir combined with Watir very quickly and efficiently allows this ability of testing (I’ve never touched Selenium, but I know there’s a good bit of configuration to it, that isn’t needed with Systir). So you can actually click on a link and then check the DOM, as Watir only cares about what IE thinks the DOM now is, not what the last call was.
Watir also has the side effect of ‘physically’ driving the browser, so you can choose to watch the test run, checking for yourself whether effects are happening or not, and if certain actions are just taking too long.
I’ve written a plugin to allow tighter integration of Selenium testing with Rails. It uses Selenium-RC to directly control the browser and check the results. I’d class it as alpha level at the moment. It should work alright, but it needs some more work. If anyone wants to try it out and let me know the result that would be great.
+1 to WATIR. What got me into Ruby. It owns.
Unit testing of GUIs, DOM based and the test scripts are very
robust if written properly (using ids etc.)
Extremely easy to get up to speed with, and straightforward
to teach to non-coders.
If Firefox is your poison, theres FireWatir but its not as mature.
(note to self to check out systir)
I haven't tried Selenium, but my hearsay tells me that it is not
a functional overlap of Watir, so between both tools you have
very powerful testing capability.
Selenium actually doesn’t require any setup if you just use the Selenium-IDE plugin for Firefox. You can build your tests by recording movements on the page and it writes the scripts for you. When you play them back, it takes control of the browser.
It can get more sophisticated if you use the Selenium-RC stuff… but the Selenium-IDE will let you save your tests (which are actually ruby files!)