Chapter 5. Testing Web Sites with HTTPUnit

The ability to test Java classes with a tool like JUnit is of great utility and importance. Because many applications are deployed as Web sites, it would also be tremendously useful to automate the testing of such applications. Manual testing of Web sites consists of a user interacting with the site through a browser, so any automated testing tool should mimic this interaction as closely as possible.

JUnit can be used as a first step toward this ideal testing tool. Writing a JUnit test is a matter of writing a Java class, so anything that can be expressed in Java can be tested. Listing 5.1 demonstrates this flexibility by showing a JUnit test that ensures that the string “Hello” appears on the first page ...

Get Apache Jakarta and Beyond: A Java Programmer’s Introduction now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.