-
1. Re: Component Testing
ssilvert Jan 21, 2008 8:49 AM (in response to kingkon)Yes you can. Just get the Application instance from the FacesContext:
Application application = jsfServerSession.getFacesContext().getApplication();
Then use one of the createComponent() methods on the Application instance.
Stan -
2. Re: Component Testing
kingkon Jan 21, 2008 9:00 AM (in response to kingkon)stan,
if you have any example with you right now ..can you send it to me...it would be helpful for me
Thanks -
3. Re: Component Testing
dennisbyrne Jan 21, 2008 10:54 AM (in response to kingkon)If you want to write pure unit tests, build JSFUnit [1] and take a look at org.jboss.jsfunit.stub . This is a port of the Shale test framework [2]. The package name "mock" was changed to "stub" because mocks aren't stubs [3]. Enjoy.
[1] http://labs.jboss.com/jsfunit/building-jsfunit.html
[2] http://shale.apache.org/shale-test/index.html
[3] http://martinfowler.com/articles/mocksArentStubs.html -
4. Re: Component Testing
kingkon Jan 23, 2008 9:37 AM (in response to kingkon)if you say to get the Application instance ..then we need to have ServerSession and ClientSession ...i am asking at the component level..means if i have created a custom component and before rendering that on to a jsf page if i need to test it ..is it possible in jsfunit
Thanks -
5. Re: Component Testing
ssilvert Jan 23, 2008 10:44 AM (in response to kingkon)If you are talking about testing outside of the servlet container then you can use the code Dennis Byrne was talking about. Dennis is working on the mock/stub library that allows you to test components outside of a running container. I'm sure he'd love to have your feedback if you want to give it a try.
Stan