!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: ServletDriver?  (Read 253 times)

Aslak Hellesøy

  • Web User
ServletDriver?
« on: March 28, 2012, 08:27:56 PM »
Hi folks,
 Some colleagues of mine want to use Cucumber (which I wrote) with
 Grails. That's simple enough if you use a browser - examples here:
 http://wiki.github.com/aslakhellesoy/cuke4duke/webdriver
 
However, that's a bit slow since you have to fire up a web server and
 run everything through HTTP. I'd much rather everything was in the
 same JVM - kind of how Rails people use Webrat without a server
 running.
 
So I thought about writing a driver that creates servlet requests and
 sends them straight to the GrailsDispatcherServlet. Do you think
 that's feasible?
 
It would be nice to have a ServletDriver that's agnostic of the
 underlying web framework, but I'm not sure how simple that is.
 
I also found an old thread about this:
 
http://groups.google.com/group/webdriver/browse_thread/thread/6b17e68...
 
So what do you think? Should I try?
 
Aslak

Simon Stewart

  • Web User
Re: ServletDriver?
« Reply #1 on: March 28, 2012, 08:28:11 PM »
Hi Aslak,
 The easiest way to do this is probably by modifying the HtmlUnit
 driver's webclient's WebConnection. Or, in code:
 
@Override
 protected WebClient modifyWebClient(WebClient client) {
    WebConnection conn = new YourWebConnection();
    client.setWebConnection(mockWebConnection);
    return client;
 

}
 

You've then got the choice of whether you want to implement a custom
 listener in Jetty or just hook directly into your web framework of
 choice (Grails, in this case)
 TBH, on a modern OS with proper handling of the loopback interface,
 I'm not sure how much overhead you'll be saving. It'd be interesting
 to find out.
 
Regards,
 
Simon
 
On Mon, Oct 26, 2009 at 8:22 PM, Aslak Hellesøy
 

- Show quoted text -

aslak hellesoy

  • Web User
Re: ServletDriver?
« Reply #2 on: March 28, 2012, 08:28:21 PM »
On Wed, Oct 28, 2009 at 4:13 PM, Simon Stewart
 

- Show quoted text -

Thanks Simon - great tips. I realise the runtime performance gain
 might not be significant - I'm trying to gain time in developer
 switching time - so people don't have to restart the web server when
 they make changes. -But maybe that's not even needed in Grails? (I'm
 still learning Grails). Anyway - I'll let you all know if I pursue and
 make progress.
 Cheers,
 Aslak
 

- Show quoted text -

Selenium Webdriver

Re: ServletDriver?
« Reply #2 on: March 28, 2012, 08:28:21 PM »

 

Review www.seleniumwebdriver.com on alexa.com