Question

I'm writing an application in groovy with grails that needs to do some automated usage of a couple of websites. So I need something that will perform a similar task to functional web application testing, without a browser being needed. I would also like it to be as lightweight as possible and of course completely headless.

There are two options that I am aware of so far. Canoo which has a nice grails plugin and conveniently also a firefox recorder plugin and EasyB/JWebUnit which can be recorded with Selenium.

Canoo seems very heavy and I don't know what I'd have to do to get it to run in a grails service neatly.

Perhaps I'm thinking about this wrongly though. Has anyone here done this kind of thing in Java or Groovy? Am I better off just dropping out to curl on the command line perhaps?

Was it helpful?

Solution

Have you though about just sending your web requests? Maybe you don't need a full blown headless browser and a line like

def html = new Url("http://example.com").text

is enough for your app?

A testing tool or framework is great when you have to click virtual buttons. But if you only have to remote control a website, sending a request could be enough.

Update: if you need to send POST requests and handle cookies, then the Url-Class isn't enough. But you can use the http builder instead. Here are two URLs which will get you started:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top