Sorry this is my first post and I am not sure how to contiune discussion on a previous thread.  Troy asked how to maintain a session across threads.  The solution that worked for me was to call the tests from one buildfile using a subant task.  Each test calls a login which is defined in a macrodef.  The login checks if the specific session exists or not and if it does it will add the session onto my URL.  The login macrodef that I wrote also allows for multiple user roles. Below is an example of my login:

<project name="Login Templates">
  <macrodef name="call-login">
    <attribute name="applicationHome"/>
    <attribute name="userRole"/>
    <attribute name="cookie" default="[EMAIL PROTECTED]"/>
    <attribute name="user" default="[EMAIL PROTECTED]"/>
    <attribute name="password" default="${ [EMAIL PROTECTED]"/>
    <attribute name="facilityRgnId" default="[EMAIL PROTECTED]"/>
    <sequential>
      <ifStep>
        <condition>
          <verifyProperty description="Verify if the user is logged in"
            name="@{cookie}"
            propertyType="ant" />
        </condition> 
        <invoke
          description="Go to the Application Home Page"
          url="" PROTECTED]" />
      </ifStep>
      <ifStep>
        <condition>
          <not>
            <verifyProperty description="Verify if the user is not logged in"
              name="@{cookie}"
              propertyType="ant" />
          </not>
        </condition>
        <invoke
          description="Get login page"
          url="">        <verifyTitle
          description="Check the title"
          text="JRI - User Login"/>
        <storeCookie
          name="JSESSIONID"
          property="${cookie}"
          propertyType="ant"/>
        <setInputField
          description="Set user name"
          name="j_username"
          value="@{user}" />
        <setInputField
          description="Set user password"
          name="j_password"
          value="@{password}" />
        <clickButton
          description="Click the submit button"
          label="Login" />
        <verifyTitle
          description="Check the title"
          text="JRI - Location Selection"/>
        <setSelectField
          description="Select a location to login as"
          name="facilityRgnId"
          value="@{facilityRgnId}" />
        <clickButton
          description="Click the submit button"
          label="CONTINUE" />
      </ifStep>
    </sequential>
  </macrodef>
</project>


I hope that makes sense.  If not I can try to answer any other questions you have.

Thanks
Jason Dumontier

Reply via email to