myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <>
Subject Re: JSF Backing Bean Unit Testing
Date Mon, 15 May 2006 13:39:55 GMT
Murat Hazer wrote:
> Hi,
> I am trying to write unit tests on my backing beans' action,
> actionListener and other methods, and using shale-test framework to
> accomplish this. From TDD principles i know every unit test should test
> only itself not other functions or layers etc., but in my scenario
> backing beans use spring managed services and these services also use
> hibernate managed DAOs, and also these backing beans use other request
> or session based beans. What are the best practices about unit testing
> backing beans like this?
> Should i also use mock objects (like jmock or easymock) for these
> properties of the backing beans? And what should i do to validate
> faces-config files? I study appfuse (on backing bean tests exceutes all
> layer functions..) and examples come with shale, they are not very clear
> (or my misunderstaning), i think i need a clear and nice sample (also
> other users) unit test on a such complicated backing bean)

If you want to do unit tests, use mock objects so that you test only the
backing bean methods.  If you want to do
functional/integration/acceptance tests, your test needs to set up
spring and container resources so that the bean executes through all the
tiers.  Depends on which you want to do.

Dave Brondsema
Software Developer
Cornerstone University

View raw message