3 Replies Latest reply on Dec 26, 2007 4:32 PM by Pete Muir

    Integration Testing - Render Response phase

    Mikhail Balshunou Newbie

      Hi all.

      I'm using Seam 2.0.1.CR1 and trying to write Seam integration test. I took one from the examples as an example :). Here is the test code (it extends SeamTest):

      @Test
       public void testLogin() throws Exception {
       new FacesRequest("/login.xhtml") {
       @Override
       protected void updateModelValues() throws Exception {
       setValue("#{identity.username}", ADMIN_USERNAME);
       setValue("#{identity.password}", ADMIN_PASSWORD);
       }
      
       @Override
       protected void invokeApplication() throws Exception {
       invokeAction("#{identity.login}");
       }
      
       @Override
       protected void renderResponse() throws Exception {
       assert (Boolean) getValue("#{identity.loggedIn}");
       }
       }.run();
      

      Everything works fine updateModelValues and invokeApplication methods are invoked, authentication is successfull, but renderResponse method is not invoked. I debug it and found this piece of code in emulateJsfLifecycle method of BaseSeamTest class:

      if ( skipRender() )
       {
       // we really should look at redirect parameters here!
       return false;
       }
       else
       {
       renderResponsePhase();
       return true;
       }
      

      so skipRender method always returns true and it has only one row inside:
      FacesContext.getCurrentInstance().getResponseComplete();
      

      Could anybody explain why it happens, why response is complete, and why renderResponsePhase should be invoked only if it's not?