2 Replies Latest reply on Jul 27, 2010 9:54 AM by devora

    Empty session for new test

    devora

      Hi!

       

      In my jsfUnit I have a few tests I run.

      I see that from test to test the session resets, and all its values are deleted.

       

      That's the way it should be?

      Is there a way the save the session from test to test?

       

      Thanks,

      Devora

        • 1. Re: Empty session for new test
          ssilvert

          Hi Devora,

           

          Good question.  The short answer is, "yes, that's the way it should be."  Normally, you want to create a new JSFSession, which clears your HttpSession.  This simulates a user hitting the application for the first time.  Then the user does some things and you can do assertions every step of the way.  You can do as many requests as you want against the same session.  Using the JSFSession/JSFClient is how you simulate a multi-request user session and isolate your tests from one another.

           

          You can reuse the same JSFSession instance from test to test.   That would let you continue with the same HttpSession spanning more than one test.  However, this kind of testing can suffer from side effects.  You might have trouble controlling the ordering of your tests.  Also, there is some dependency on how Cactus calls your tests.  If the ServletRedirector is called more than once then all bets are off because doing that can give you a new HttpSession.

           

          Stan

          • 2. Re: Empty session for new test
            devora

            Thanks!