8 messages in org.apache.myfaces.usersRe: JSF Backing Bean Unit Testing
FromSent OnAttachments
Murat HazerMay 14, 2006 5:11 am 
Craig McClanahanMay 14, 2006 1:15 pm 
Murat HazerMay 14, 2006 11:46 pm 
Dave BrondsemaMay 15, 2006 6:39 am 
Adam BrodMay 15, 2006 7:22 am 
Murat HazerMay 15, 2006 8:15 am 
Adam BrodMay 15, 2006 11:01 am 
Dave BrondsemaMay 17, 2006 10:11 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: JSF Backing Bean Unit TestingActions
From:Craig McClanahan (crai@apache.org)
Date:May 14, 2006 1:15:23 pm
List:org.apache.myfaces.users

On 5/14/06, Murat Hazer <mura@gmail.com> 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?

For the third scenario (need access to other request and session scope beans) you can populate the attributes on the MockHttpServletRequest and MockHttpSession instances. I do this in the setUp() method of my unit tests.

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)

regards...

Craig