Chapter 15. Testing JSF applications

 

The first 90% of the code accounts for the first 10% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

Tom Cargill

This chapter covers

  • The problems of testing JSF applications
  • Mock solution of the problems
  • JSF unit/integration testing using JSFUnit
  • JSF performance testing with JSFUnit

The Cactus framework we introduced in chapter 14 is great for testing most of the Java EE specifications. On a daily basis, the majority of Java developers write Java EE applications, all of which are based on the Java EE spec.

In this chapter we take a closer look at the newest member of the Java EE spec—the JavaServer Faces (JSF) technology. It’s a standard specification developed through the Java Community Process (JCP) for building Java web-based user interfaces. We start the chapter by explaining what JSF is, the problems of testing JSF applications, and how to use the JSFUnit project to solve them. We then implement a sample MusicStore application and demonstrate the power of JSFUnit.

15.1. Introducing JSF

15.2. Introducing the sample application

15.3. Typical problems when testing JSF applications

15.4. Strategies for testing JSF applications

15.5. Testing the sample application with JSFUnit

15.6. Using HtmlUnit with JSFUnit

15.7. Performance testing for your JSF application

15.8. Summary