Chapter 33: HttpUnit API Reference


Overview

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.

Chapter 16 gives a basic example of DOM manipulation with HttpUnit. If you are interested in reading more, see http://www.w3.org/DOM/ for general information and to download the DOM API in Java.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net