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
signature.asc
Description: OpenPGP digital signature

