Java Reference
In-Depth Information
Figure 15.2
The two screens of the MusicStore application
We're finished; the MusicStore application is now complete. In order to see it in
action, you have to get the topic source code online. We've provided a Maven script
with a configured Jetty plug-in; all you have to do is go to the command line, navi-
gate to the folder that contains the pom.xml file for the project, and invoke the
Jetty plug-in:
> mvn jetty:run -Pjetty
The Jetty servlet container will start, and if you navigate to http://localhost:8080/
ch15-jsfunit/ , you should be able to see the application in action (figure 15.2).
The first image displays all the available albums, and if you click any given album,
you should see the second part of the figure, where you can see the details for the
album and purchase it.
Moving on, in the next sections we describe how to test the various parts of
this application.
15.3
Typical problems when testing JSF applications
As you've seen so far, JSF applications typically consist of POJO s (called managed
beans) and some frontend JSP s. Here, our managed beans are simple and therefore
easy to unit test. So why are JSF applications hard to test?
Indeed, the managed beans are easy to unit test, but the hard part comes when you
want to include interaction with a container in your tests. Normally tests give you the
security you need to mercilessly refactor your application. They provide you with con-
fidence that you haven't introduced a new bug into the system.
What could possibly break in a normal JSF application? Here's list of typical prob-
lems that might occur in a JSF application:
Managed bean problems
Managed bean method problems
Faces-config.xml typos
Improper interface implementation
Missing getter/setter methods
 
 
Search WWH ::




Custom Search