Chapter 10. Unit-testing JSPs and taglibs

This chapter covers

  • Unit-testing a JSP in isolation with Cactus and mock objects

  • Running Cactus JSP tests with Maven

  • Unit-testing taglibs with Cactus

  • Unit-testing taglibs with mock objects and MockMaker

 

A test that can’t be repeated is worthless.

 
 --Brian Marick

In this chapter, we’ll continue with the Administration application we introduced in chapter 9. In chapter 9, we focused on unit-testing the servlet component of the application. In this chapter, we concentrate on the view components—namely the JavaServer Pages (JSPs) and custom tag libraries (taglibs).

We’ll cover unit-testing JSPs and taglibs with both Cactus and mock objects. The two techniques are complementary. Mock objects excel at writing focused, ...

Get JUnit in Action 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.