HttpUnit API Reference


HttpUnit abstracts elements of an HTTP “conversation” between a server and a client in a way that makes it possible to run JUnit assertions against the result. This chapter details the HttpUnit framework. HttpUnit is designed so that most of the classes that are not directly used by a test developer are hidden from immediate view (as package-level access classes, inner classes, and so on). We used the published Javadoc for HttpUnit as a guide to help us choose which classes to include in this chapter. HttpUnit automatically parses the HTML contained in a server response into a Document Object Model (DOM) tree. This is one of the key features of the framework as it enables most of the methods that return data about the server response, such as getLinks(). In addition to relying on the DOM tree under the covers, HttpUnit exposes the DOM to allow direct inspection. By interacting directly with the DOM when necessary, TestCases can perform more sophisticated assertions than are available through HttpUnit's convenience methods , but at the price of additional development effort.

gives a basic example of DOM manipulation with HttpUnit. If you are interested in reading more, see for general information and to download the DOM API in Java.