-
1. Re: integration test problem
seto.kaibaseto.gmail.com Feb 19, 2008 6:00 PM (in response to seto.kaibaseto.gmail.com)No one reply for it? Anyone helps?
-
2. Re: integration test problem
dhinojosa Feb 19, 2008 8:06 PM (in response to seto.kaibaseto.gmail.com)Probably no one has helped because you didn't post any code.
You have stuff you can post on here?
-
3. Re: integration test problem
seto.kaibaseto.gmail.com Feb 20, 2008 2:28 AM (in response to seto.kaibaseto.gmail.com)@Test public void test changePassword(){ new FacesRequest("/security/changePassword.xhtml"){ @Override protected void renderResponse(){ assertEquals(getRenderedViewId(),"/security/login.xhtml"); } }.run(); }
Because of the redirection, the renderResponse phase isn't entered at all. So my test has no effect. So if I want to assert the redirection. How to?
-
4. Re: integration test problem
pmuir Feb 20, 2008 10:59 AM (in response to seto.kaibaseto.gmail.com)In the next request (thats what a redirect does if you think about it...)
-
5. Re: integration test problem
larshuber Mar 28, 2008 1:45 PM (in response to seto.kaibaseto.gmail.com)How looks the next Request like? Could you give an example, please. Do you use a NonFacesRequest or a FacesRequest. For example if you have this entry in the pages.xml. How do you check that it really redirects to home.xhtml and the param message is set?
<navigation> <rule if-outcome="persisted"> <end-conversation before-redirect="true" /> <redirect view-id="/home.xhtml"> <param name="message" value="msg.AccountCreatedConfirmationSent" /> </redirect> </rule> </navigation>
-
6. Re: integration test problem
luxspes Jul 29, 2008 7:55 PM (in response to seto.kaibaseto.gmail.com)Hi!
Seto Kaiba wrote on Feb 20, 2008 02:28:@Test public void test changePassword(){ new FacesRequest("/security/changePassword.xhtml"){ @Override protected void renderResponse(){ assertEquals(getRenderedViewId(),"/security/login.xhtml"); } }.run(); }
Because of the redirection, the renderResponse phase isn't entered at all. So my test has no effect. So if I want to assert the redirection. How to?I was having a similar problem, and the closest I could get to verifying if security was working was this:
@Test public void test changePassword(){ new NonFacesRequest("/security/changePassword.xhtml"){ @Override protected void afterRequest() { Assert.assertFalse(this.isRenderResponseBegun(), "Response was rendered and that was not expected"); } }.run(); }
Hope this helps others trying to do something like this.
Regards,