views:

67

answers:

3

Hello all,

I am developing a servlet application, I was using JWebUnit, to check all the basic responses, but now I have to start using other HTTP methods different to GET(POST,PUT and DELETE).

So, I found HttpUnit, it looks that have support for what I need, POST and PUT methods are available there and I guess I can walk around the DELETE method through the HEAD which is supported by HttpUnit.

However I found there is no recent activity in this project; the last release was about two years ago. so my question is if there is any other library that people is using for it or HttpUnit is the right for my case?

Thanks.

+2  A: 

Httpunit is a mature library. It works just fine for what you are trying to do.

Sasi
A: 

Agreed with @Sasi.

It should also be noted that there are occasional checkins to the project's SVN repository. The most recent were a couple of months ago to apply a contributed patch for a bug. So there are still developers taking care of the code.

Stephen C
That's good to know! I didn't noticed, thanks for the info!
4NDR01D3
+1  A: 

I recommend HtmlUnit instead. No disrespect intended towards HttpUnit: I used it a few years ago and it worked well. However it died as a project for a number of years, and more particularly it had little support for Javascript, so I switched to HtmlUnit

HtmlUnit has been steadily developed since its inception and has exceptional Javascript support. I have used it to test sites containing a lot of Ajax and only once, I think, did it not properly execute the JS code (turned out to be a wee HtmlUnit bug, which I fixed). There are a lot of hooks available to help you test what's going on.

As well, as the site says, "HtmlUnit is used as the underlying 'browser' by different Open Source tools like Canoo WebTest, JWebUnit, WebDriver, JSFUnit, Celerity, ..." I haven't used those, as I prefer expressing my tests in Java, but I understand HtmlUnit works well for them.

Rodney Gitzel
But does HTMLUnit provides a way to query a URL using the http methods PUT and DELETE??
4NDR01D3
Yup, it just takes an extra step of creating a "WebRequestSettings" first: http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebClient.html#getPage%28com.gargoylesoftware.htmlunit.WebWindow,%20com.gargoylesoftware.htmlunit.WebRequestSettings%29
Rodney Gitzel
Cool! I marked this as the answer because of 2 reasons: firstly, HTMLUnit does support the DELETE method, in contrast of HTTPUnit where I was looking for a work-around way. And secondly as @gregory commented I was already including it whilst working with JWebUnit, so I wont require to add anything else to my require libraries.
4NDR01D3
Glad to be of help. And yay, my first accepted answer! *happy dance*
Rodney Gitzel