HttpUnit

The normal way to access web sites is via a browser; however, there are times when it is desirable to bypass the browser and access a site from a program, including:

HttpUnit makes this easy. Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links.

A companion framework, ServletUnit is included in the download.

What is it?

HttpUnit is a free, open source Java API for accessing web sites without a browser, and is ideally suited for automated unit testing of web sites when combined with a Java unit test framework such as JUnit. It was designed and implemented by Russell Gold.

Documentation

A rudimentary User's manual is available, as are a tutorial, a FAQ and the javadoc. Several working example files come with the distribution download.
In addition, Wiley press has published Java Tools for Extreme Programming: Mastering Open Source Tools, including Ant, JUnit, and Cactus which contains two chapters dealing with HttpUnit.

Where do I get releases?

Releases of HttpUnit are available from the project download page.
Other builds are available from the pre-release directory.

How do I get help, contribute, give feedback, fix bugs and so on?


A Japanese version of this page and the cookbook are available, thanks to Tuyoshi Ushio.