3 Replies Latest reply on Mar 29, 2008 4:03 PM by Pete Muir

    Wrong conversation component in integration tests

    Lars Huber Newbie

      I want to test my UserHome component defined for Conversation scope. With debugging I see that the component is created and initialized correctly through the call from pages.xml. And also at the end of the test the correct component is destroyed visibly by debugging.

      But in my test methods the instance I get is a new UserHome and is not initialized. It also doesn't @Destroy at the end of the test. In production mode the UserHome works correctly.

      Where is my real UserHome gone? Is my test wrong? As template I took tests from Wiki.


           public void testRegisterUser() throws Exception {
                final String conversationId = new NonFacesRequest("/userRegister.xhtml") {
                     protected void renderResponse() throws Exception {
                          UserHome _home = (UserHome)getInstance("userHome");
                          assert isLongRunningConversation();
                new FacesRequest("/userRegister.xhtml", conversationId) {
                     protected void invokeApplication() throws Exception {
                          assert isLongRunningConversation();
                          UserHome _home = (UserHome) getInstance("userHome");
                          assert _home.getInstance() != null;

      greets Lars


           <page view-id="/userRegister*"
                <action execute="#{userHome.init}" />
                <begin-conversation flush-mode="MANUAL" join="true" />
                     <rule if-outcome="persisted">
                          <end-conversation before-redirect="true" />
                          <redirect view-id="/pomop.xhtml">
                               <param name="message" value="pomop.msg.AccountCreatedConfirmationSent" />