Joseph Wilk wrote:
My mind was stuck in Rspec but looking at this as an adapter for Webrat is a great idea.

I've had a play with Webrat and a test Selenium adapter ala the Mechanize one. Things start to get a little tricky around having to have the domain defined first in the Selenium. Meaning in Selenium its hard to do:

1. visits('http://www.google.co.uk')
2. visits('http://www.monkeys.co.uk')

Status codes are also not great fun (http://clearspace.openqa.org/message/8115#8115). I'll continue playing with this and see how easy it will be to squeeze Selenium into the Webrat box.

One could then perhaps create an extension of webrat's language to form
a uniform way of expressing JS/AJAX behavior.

Sounds like a good idea. I guessing you mean some friendly wrapper to something like: 'xml_http_request' in ActionController::Integration::Session
http://api.rubyonrails.com/classes/ActionController/Integration/Session.html#M000251

Aswell as just Ajax/JS stuff as an ability to perform more advanced interrogations (but always optional to keep the wonderful simplicity of Webrat's usage) would be a nice addition to Webrat. Something similar to Selenium's xpath like expressions. I'm not sure if Watir has something similar.

The whole JS/AJAX behavior missing from Webrat has been making me look at the introduction of Server-side JS. Things like: Jaxer(http://www.aptana.com/jaxer) & Rhino(http://www.mozilla.org/rhino/). Whether its possible to push forward what JS Webrat can handle (be it that its never going to be a real browser). The real browser testing makes a lot of sense when examining different browsers JS/CSS processing but there are a lot of use-cases where simple DOM manipulation is good enough.
http://www.magpiebrain.com/blog/2007/01/28/selenium-rocks-and-you-dont-need-it/


Very cool. Keep me posted on your progress. I would love to jump in and help but I don't have the bandwidth to do so quite yet... soon though. The post you linked to at the bottom talking about HTTPUnit is interesting. The project that Aslak mentioned is basically a JRuby wrapper for HTTPUnit using the watir API... So, as Aslak suggested if we had a webrat adapter for watir then we would not only get waitir support but HTTPUnit capabilities! That would be three wrappers!

I'm a little confused by the JS capabilities of HTTPUnit... on the bottom of that post the author made a comment: " anything (not just Javascript) which manipulates the DOM after the page has been served will require in-browser testing – either manual or automated."

Does anyone have experience with HTTPUnit? My understanding of HTTPUnit is that it will process the JS after the page loaded (and there FAQ seems to suggest this as well.) Most of my sites use unobtrusive JS, meaning it all works without JS but then JS is used to add additional user interfaced niceties (AJAX, effects, etc..) So will HTTPUnit process the JS and update the DOM accordingly? This is probably the wrong mailing list to answer this, but if anyone has had experience with HTTPUnit please share.

-Ben

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to