-
1. Re: How to test a page with page action method?
thejavafreak Jan 30, 2008 6:50 AM (in response to hubaghdadi)Try testing your Action component instead. This is written in the documentation.
-
2. Re: How to test a page with page action method?
hubaghdadi Jan 30, 2008 6:56 AM (in response to hubaghdadi)This is exactly put me back to my original problem:
How to unit test an action class that have a dependency on Seam managed Hibernate session?
How to bootstrap Hibernate Session in unit tests?
(I posted it as a question previously but I didn't get an answer). -
3. Re: How to test a page with page action method?
thejavafreak Jan 30, 2008 9:27 PM (in response to hubaghdadi)If you want to bootstrap the hibernate managed session, you must use integration testing. This is written in the docs.
-
4. Re: How to test a page with page action method?
hubaghdadi Jan 31, 2008 2:40 AM (in response to hubaghdadi)I'm not arguing you but I think it is possible to write unit tests (not integration tests) for Seam managed Hibernate sessions.
I read Michael Yuan's book "JBoss Seam", he wrote a unit test for an action that uses an entity manager, he initialize the entity manager by hand, inject it into the action class, running the test, voila.
Any way, I tried to write some integration tests:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=128867 -
5. Re: How to test a page with page action method?
pmuir Feb 3, 2008 5:16 PM (in response to hubaghdadi)On unit testing with a persistence context - yes you can do it (as in Michael's book) but I don't think it is sensible (I will suggest they take it out for the 2nd edition).
On page actions - it "just works"new FacesRequest("/foo.xhtml") { }.run();
will run the page action.