1 Reply Latest reply on Sep 10, 2007 11:32 AM by nayan j

    Seam Integration Test

    nayan j Newbie

      I am using Seam 1.2.1 and trying to write an integration test for my code. The pages run fine when deployed on server. However, when I run my testcase, I get following exception:

      FAILED: testUpdate
      javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'profileaction'
      at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
      at com.sun.el.parser.AstValue.getTarget(AstValue.java:67)
      at com.sun.el.parser.AstValue.setValue(AstValue.java:147)
      at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:258)
      at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44)
      at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374)
      at us.crimnet.iss.profile.test.ProfileActionTest$3.invokeApplication(ProfileActionTest.java:63)
      at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
      at us.crimnet.iss.profile.test.ProfileActionTest.testUpdate(ProfileActionTest.java:74)
      ... Removed 22 stack frames


      Obviously, there is something wrong with my test code but I cannot figure it out. Documentation seems to be very sparse on this topic.

      My code is something like following:

      public void testUpdate() throws Exception {

      new FacesRequest() {

      @Override
      protected void invokeApplication() throws Exception {
      // identity.login invoked from here
      // along the lines of booking example..
      // btw, what is a FacesRequest() with no parameters for ?
      }
      }.run();

      new FacesRequest("/main.xhtml") {
      // doing nothing here right now.
      }.run();

      new FacesRequest("/mypage.xhtml") {
      @Override
      protected void invokeApplication() throws Exception {

      User user = (User) Contexts.getSessionContext().get("user"); // has Session scope

      assert user.getGivenName().equals("Given");
      assert user.getLastName().equals("Last");

      MyBean bean = new MyBean(); // has Conversation Scope
      Contexts.getConversationContext().set("bean",bean);
      bean.setValue("value");

      MyAction action = new MyAction(); // has EVENT Scope
      Contexts.getEventContext().set("myaction",action);
      setValue("#{myaction.user}",user); // Exception at this line!!
      setValue("#{myaction.bean}",bean);

      // have to call myaction.update method and then test how values of user and bean change..

      }
      }
      }


      please help...