Installing HttpUnit
Problem
You want to install HttpUnit.
Solution
Add httpunit.jar and
Tidy.jar, both
included
with HttpUnit, to your classpath. Also ensure that an XML parser is
installed.
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.
See Also
Recipe 5.3 shows how to configure HttpUnit with Ant.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access