[rspec-users] Selenium/Watir usage along side Webrat in story testing

Joseph Wilk lists at ruby-forum.com
Tue Jun 10 12:10:11 EDT 2008

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 

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 

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.

Joseph Wilk

Ben Mabey wrote:
> Joseph Wilk wrote:
>> (I suspect Webrat represents the smallest set of functionality -
>> contributing to whatever project is going to be the best fit. So I'm
> Hey Joseph,
> Have you looked at webrat in github lately?
> http://github.com/brynary/webrat/tree/master
> Bryan is abstracting webrat so that different adapters can be plugged
> into it.. Meaning, the same wrappers/syntax can be used to drive rails,
> merb, mechanize, etc... I think a selenium or watir adapter for webrat
> would be awesome.  I'm not too experienced with selenium but it doesn't
> strike me as being too hard to do.  You make a good point in that webrat
> is a small subset of what the other JS aware frameworks can do but I
> think what webrat currently has would handle a lot of the use cases.
> One could then perhaps create an extension of webrat's language to form
> a uniform way of expressing JS/AJAX behaviour.
> The mechanize adapter idea is neat too, because you could then use it to
> test any website no matter what the implementation is.  I know that part
> of Bryan's motivation behind the mechanize spike is to eventually use
> the stories to do performance testing as well.
> This is a problem I'm also interested in but I haven't yet needed to use
> selenium enough to make me want to do anything about it. :)  I think the
> selenuim adapter for webrat approach would be a great way to approach
> this problem though.  What do you think?
> -Ben

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list