1 Reply Latest reply on Mar 1, 2007 12:35 PM by denis-karpov

    Testing Pageflow with SeamTest

    denis-karpov

      Is it possible to test Pageflow conversations with the "mock" environment ?
      Is there a special technique or a sample how to do this?

      P.S. I have found that Seam's testing environment is an extremely useful and elegant. It increases productivity in many times. Now i stuck in testing pageflows, but i already can't live without testing ;-)

      Thanks.

        • 1. Re: Testing Pageflow with SeamTest
          denis-karpov

          I think there is bug in testing environment (propagation of conversations with pageflow does not work)

          In this test there is 2 requests.
          In the first I start conversation and pageflow
          In the second conversation is lost.

          If I do not start pageflow then conversation propagates.

          public class TOrdTest extends SeamTest{
           private static final Log log = LogFactory.getLog( TOrdTest.class );
          
           @Test
           public void Test1() throws Exception
           {
           String id = new FacesRequest(){
           @Override
           protected void invokeApplication() throws Exception {
           Conversation.instance().begin();
           Pageflow.instance().begin("val_buy");
           setOutcome("browse");
           log.info("##### 1 Conversation_ID "+ Conversation.instance().getId());
           assert isLongRunningConversation();
           }
           @Override
           protected void renderResponse() throws Exception {
           }
           }.run();
          
           id = new FacesRequest("/exchange/buy_readonly.xhtml",id){
           @Override
           protected void beforeRequest()
           {
           log.info("#####beforeRequest Conversation_ID "+ getConversationId());
           }
           @Override
           protected void applyRequestValues() throws Exception {
           log.info("##### 2 Conversation_ID "+ Conversation.instance().getId()+" "+getConversationId());
           }
           @Override
           protected void invokeApplication() throws Exception {
           //Conversation.instance().beginNested();
           log.info("##### 3 Conversation_ID "+ Conversation.instance().getId()+" "+getConversationId());
           assert isLongRunningConversation();
           }
           }.run();
           }
          }