1 Reply Latest reply on Nov 13, 2009 9:29 AM by Stan Silvert

    Passing JSFSession from test to next test in suite

    Petr Vydra Newbie


      I have question: maybe I badly understand matter of Unit tests, but I would like to make some kind of "functional test" with JSFUnit tests. I 'd like to test my Seam webapp. So first test is login test (make session, login), next step is navigate to and run first use-case (jsf page) and test it, then next and so on.... till last UC (implemented as Test suite)

      My problem restraining in such realization is problem how to pass JSFSession from test to next test. Every attempt ends with session.getJSFServerSession() is null...context is empty (FacesContextBridge.getCurrentInstance() is null too).

      So is there any solution?

      Thx in advance.

        • 1. Re: Passing JSFSession from test to next test in suite
          Stan Silvert Master

          In general, you should create a new JSFSession for each new test. That way, each test is isolated from the side effects of the previous test.

          However, if you really want two tests to share the same JSFSession then just let the first test set the JSFSession as an instance variable and the second can use it.

          If you are still having trouble, feel free to post your code.