0 Replies Latest reply on May 15, 2012 12:54 PM by eulbergrj

    Seam-Gen Edit Page Does Not Properly Propagate Through JSF Life Cycle in SeamTest

    eulbergrj

      Hi,

       

      I am attempting to create a very basic SeamTest class for a super basic Seam generated <Classname>Edit.xhtml facelets page. The problem that I am facing is that, when I run the test using TestNG, the page will not make it past the Restore View phase of the JSF life cycle, which means none of the override methods in the Seam test class, other than the beforeRequest, get invoked.

       

      Example Test Class

      ---------------------------------------------------------------------------------------------------------------------------------------------------------

      package org.domain.seamless.test;

       

      import org.jboss.seam.mock.SeamTest;

      import org.testng.annotations.Test;

       

      public class MyClassEditTest extends SeamTest {

         

          @Test

          public void test() throws Exception {

              System.out.println("hello test 123");

             

              new FacesRequest("/MyClassEdit.xhtml") {

                  @Override

                  protected void beforeRequest() {

                      System.out.println("beforeRequest Method Invoked");        // <---- WORKS

                  }

       

                  @Override

                  protected void updateModelValues() throws Exception {

                      System.out.println("updateModelValues Method Invoked");    // <---- METHOD NEVER CALLED

                  }

                 

                  @Override

                  protected void invokeApplication() {

                      System.out.println("invokeApplication Method Invoked");    // <---- METHOD NEVER CALLED

                  }

                 

                  @Override

                  protected void renderResponse() {

                      System.out.println("rendorResponse Method Invoked");    // <---- METHOD NEVER CALLED

                  }

              }.run();

          }

      }

       

      ---------------------------------------------------------------------------------------------------------------------------------------------------------

       

      The test classes that I created for <Classname>List.xhtml and <Classname>.xhtml work fine and propogate as expected through each phase of the life cycle.

       

      All of the Seam classes were Seam generated by right clicking on the project, going to New and Seam Generated Entities. Basically, I am simply creating the Seam project based on some simple table from the database. Nothing fancy here at all and nothing modified after the seam-gen process.

       

      From a UI perspective, I am testing the "Edit" page that gets called when clicking the Edit link on a row returned from the Search Results page (ie. the "List" page from the "Browse Data" menu option at the top).

       

      Is there a particular reason why the SeamTest class for the Edit page does not propagate through the JSF life cycle properly?

       

      Versions

       

      JDK 1.6

      Seam 2.2.2 Final

      JBoss 5.1

      JSF 1.2

      JPA 1.0

      Eclipse 3.7.2

      Oracle XE 11g R2

       

       

      Thank you for your help!

      -Ryan