4 Replies Latest reply on Nov 16, 2011 4:57 PM by mikeydowntown

    JSFUnit and Seam named conversation problem

    Bernard Labno Master

      Hi Stan!


      JSFUnit is so great! I'm successfully testing my Maven+Seam+JSFUnit+Unitils app. Still using Cargo (didn't have time for arquillian yet).


      Everything was working great until I've switched named conversations on. Now I get redirected to my main page and get following faces message :


      The conversation ended, timed out or was processing another request


      Here is my sample test (which I guess will not tell you much):


      public void testCreateModel() throws Exception {
              JSFSession jsfSession = new JSFSession("/");
              JSFServerSession server = jsfSession.getJSFServerSession()
              JSFClientSession client = jsfSession.getJSFClientSession();
              CommonSteps.login(jsfSession, "s4237@pjwstk.edu.pl", "aaaaa");
              /**Enter boat model list page*/
              /**Enter boat model add page*/
              assertEquals("/view/boat/model/edit.xhtml", server.getCurrentViewID());
              /** Fill the form */
              simulateFillingInEditionForm(jsfSession, "Phobos", "6", "3", "8", "1", "0", "1", "0.50", "5", "20", "150", "1", "STEERING_WHEEL", "20", "BENZINE", "1");


      Here is how I declare the conversation:


      <conversation name="boatModel" parameter-name="boatModelId" parameter-value="#{empty boatModelHome.id ? '' : boatModelHome.id}"/>

      And my edit.page.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
            login-required="true" conversation="boatModel">
          <rewrite pattern="/boat/model/edit/{boatModelId}"/>
          <rewrite pattern="/boat/model/add/{name}"/>
          <rewrite pattern="/boat/model/add"/>
          <param name="boatModelId" value="#{boatModelHome.id}" converterId="javax.faces.Long"/>
          <param name="name" value="#{boatModelHome.instance.name}"/>
              #{empty boatModelHome.instance.id ? messages['view.boat.model.edit.conversationDescription.add'] : messages['view.boat.model.edit.conversationDescription.edit']}
              #{empty boatModelHome.instance.id ? null : boatModelHome.instance.name}
          <begin-conversation join="true" flush-mode="manual"/>
          <navigation from-action="#{boatModelHome.persist}">
              <rule if-outcome="persisted">
                  <end-conversation before-redirect="true"/>
                  <redirect view-id="/view/boat/model/list.xhtml"/>
          <navigation from-action="cancel">
              <end-conversation before-redirect="true"/>
              <redirect view-id="/view/boat/model/list.xhtml"/>
        • 1. Re: JSFUnit and Seam named conversation problem
          Stan Silvert Master

          Hi Bernard,


          Glad JSFUnit has been working well for you up until now.


          I don't know how much time I will be able to spend on this, but I'm looking at the code and trying to remember exactly how this works.


          At what point in your code do you get this?

          The conversation ended, timed out or was processing another request"

          I don't see any EL where you are referencing "seamconversation".


          That being said, it will probably require some code changes to provide EL support for named conversations.  Right now I'm just searching the HttpSession to find the first attribute that starts with ScopeType.CONVERSATION.getPrefix().  If there is more than one conversation id in the session then things will break.



          • 2. Re: JSFUnit and Seam named conversation problem
            Bernard Labno Master

            The faces message is triggered after


            I do not need yet to look through conversation scope (which would be great later). I just want to write happy path tests to be sure on every stage of development that code that was once written still works. So I use JSFUnit to click around the application and do assertions about messages printed to user, viewId and urls and database state.

            So this error looks like something breaks when htmlunit submits the form. I will try to test this usecase with pure htmlunit and tell if that breaks. But I guess it won't cause I was able to click myself around the app after tests were done. This must be something with special JSFUnit FacesContext.

            Thanks for your time, You are doing magnificent job Stan.

            • 3. Re: JSFUnit and Seam named conversation problem
              Jeremiah Orr Newbie

              We are experiencing this exact problem. When we use a named/natural conversation, and use client.click(), we get kicked to the "no conversation" view with the message "The conversation ended, timed out or was processing another request".


              Has there been any progress on this issue? We are currently using JSFUnit 1.3.0.

              • 4. Re: JSFUnit and Seam named conversation problem
                mikeydowntown Newbie

                Having the exact same issue here with 2.0.0.Beta2 and am stuck. Any tips would be greatly appreciated!