Http Unit

If you have to test a web server at the http level then you need this code.

HttpUnit -- a TestingFramework for web servers.

(See also HtmlUnit.)

Conversation moved to WebTesting.

Try this: Combined with JavaUnit, It allows automated testing of web applications, with the tests written in Java. Obviously, it doesn't matter what language the web application is in. It should work fine for Java servlets, mod_perl, cgi, JSP, ASP, CFM or anything else that sends HTML to a browser.

-- RussellGold

Here's an example of a test written with that library:

 public void testDynamoPageTitle() throws Exception {  // let JUnit catch unexpected exceptions
WebConversation conversation = new WebConversation();
WebResponse response = conversation.getResponse( IndexPage.url()+"testpage.jhtml" );
assertEquals( "page title", "TestPage", response.getTitle() );

Sometimes the following is required to get existing pages to work.


So.. who's working on a PythonLanguage version of this tool ?

I think jython (Python implementation in Java) might be the right choice.

In my opinion, HttpUnit has gotten a lot more promising since HttpUnit 1.5 uses a more forgiving HTML parser. Maintenance of existing code is more common than creating new perfect HTML. -- MichaelFinney

There is a nicer wrapper/interface to HttpUnit (IMHO) - JwebUnit at - it's a lot easier to code with, but - it also has a Fit framework fixture - so instead of typing all this code you can use fit ( or even easier the download and run fitnesse ( to put all this Acceptance testing of web apps into a wiki table, then you don't need to write code, you get the customer specifying acceptance tests to type them into a table in excel and run them through a fit wiki... :-) -- ChrisBarham

The FAQ at says "Of course, if you know a tech writer who would like to contribute to improving the documentation, that is always welcome." Wouldn't this wiki be a good place to start collecting HttpUnitDocumentation?, edited by the community? Then if RussellGold is happy with the result he can include it in the distro. - PhilipReed 2005-10-07

See WebTesting, HttpUnitTutorial


EditText of this page (last edited October 7, 2005) or FindPage with title or text search