[ Team LiB ] Previous Section Next Section

5.2 Installing HttpUnit

5.2.1 Problem

You want to install HttpUnit.

5.2.2 Solution

Add httpunit.jar and Tidy.jar, both included with HttpUnit, to your classpath. Also ensure that an XML parser is installed.

5.2.3 Discussion

httpunit.jar contains the class files for the HttpUnit application. Its API allows you to send requests to web servers, obtain responses, and test the content of the resulting web pages. It also contains the com.meterware.servletunit package for testing servlets directly, without going through a web server.

Tidy.jar, also included in the HttpUnit distribution, contains the Java port of HTML Tidy, an open source tool for checking the syntax of HTML. HTML Tidy also includes an API for parsing HTML, which is the part used by HttpUnit. You can learn more about the Java port of HTML Tidy at http://sourceforge.net/projects/jtidy.

If you are running under JDK 1.4, add httpunit.jar and Tidy.jar to your classpath. If you are running an older version of Java, you must also include a JAXP-compliant XML parser in your classpath. The next recipe shows how to do this.

5.2.4 See Also

Recipe 5.3 shows how to configure HttpUnit with Ant.

    [ Team LiB ] Previous Section Next Section