Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can test managed beans in isolation, by calling the methods that the JSF implementation would have called. For example, in a unit test, you might invoke the setName and setPassword method to simulate the decoding of the field values. Then invoke the login action method and check its return value. This is very much in the spirit of unit testing.
Problems arise when your managed bean is connected to backend systems; for example, a database. It is a good idea to separate out the database logic from the managed beans. This division arises naturally if you use EJB session beans for the database access. Then you can replace the EJB session beans with fake classes that simulate the database activity. Of course, your test harness needs to wire up the managed beans with the fake classes.