This chapter described testing of servlet-based Web apps on three different layers:

Function tests for a Web interface are required in all of these cases, whereas there is a choice of different testing technologies. To create expensive integration tests, like those supported by Cactus, it appears worth-while to wait until we actually hit recurring deployment and integration problems. However, this optimistic waiting means that there is a reassuring test suite handily available for the single servlets.

In addition, this chapter introduced an approach on how to separate a servlet's logic from the servlet API to improve testability. Finally, we discussed several ways to generate HTML and how to test this code.

This chapter showed that test-first development is also possible for Web apps. Once more, we noticed that the use of mock objects can contribute to decouple classes and thus to improve the design.