Hi,

I tried using:

What I did in order to solve similar problems was to set the cookie
header on the config element.
Here is an example:

<config
   host=3D"${admin.host}"
   port=3D"${admin.port}"
   protocol=3D"http"
   summary=3D"true"
   saveresponse=3D"true"
   verbose=3D"true"
   resultpath=3D"C:\webtest\tests\results"=20
   resultfile=3D"report.xml"=20
   autorefresh=3D"true"
   haltonfailure=3D"false"
   haltonerror=3D"false"=20
   showhtmlparseroutput=3D"true">
  =20
   <header name=3D"Cookie" value=3D"JSESSIONID=3D${sessioncookie};
space_user=3D${space_user}"/>
  =20
   </config>

As:

In my login flow I Set:

<storeCookie name="JSESSIONID" property="dcookie" />

<verifyCookie name="JSESSIONID" text="#{dcookie}" />

<storeProperty
        description="convert dynamic to Ant"
        name="cookie"
        propertyType="ant"
        value="JSESSIONID=#{dcookie}"/>
        
<verifyProperty description="Verify ant property antProp contains the word 
'Warning'"
      name="cookie"
      propertyType="ant"
      text=".*JSESS.*"
      regex="true" />      
        
This is my config.xml:

<config
  host="localhost"
  port="80"
  protocol="http"
  basepath="artist" 
  summary="true"
  saveresponse="true"
  showhtmlparseroutput="true"
  haltonfailure="false"
  resultpath="/root/projects/canoo/webtest_indie/results"
>

<option name="IgnoreOutsideContent" value="false"/>

<header name="Cookie" value="${cookie}"/>

</config>

And this is one testcase i am using:

<project name="loginAndStep" default="case" basedir="..">
  <target name="case">
    <webtest name="loginAndStep">
      &config;
      <steps>
      &login;      
      </steps>
    </webtest>
    <webtest name="loginAndStep">
    <config
      host="stage.indiemarketer.net"
      port="80"
      protocol="http"
      basepath="artist" 
      summary="true"
      saveresponse="true"
      showhtmlparseroutput="true"
      haltonfailure="false"
      resultpath="/root/projects/canoo/webtest_indie/results"
    >
    
    <option name="IgnoreOutsideContent" value="false"/>
    
    <header name="Cookie" value="${cookie}"/>
    
    </config>

      <steps>
      &defineGoals;      
      </steps>
    </webtest>    
  </target>
</project>

In defineGoals i check the property:

<verifyProperty description="Verify ant property antProp contains the word 
'Warning'"
      name="cookie"
      propertyType="ant" 
      text=".*JSESS.*"
      regex="true"
      />


The verifyProperty passes, but the cookie is not set in CONFIG.xml or even in 
the config xml used directly.

Please provide some insight, i am stuck.

Thanks in Advance,
Amit 



----- Original Message ----
From: amit shrivas <[EMAIL PROTECTED]>
To: [email protected]
Sent: Saturday, March 17, 2007 3:45:17 AM
Subject: Re: How to set JESSIONID cookie header after storing cookie..

Hi Marc,

Thanks for ur response, actually i am not able to set it even once, the one i 
have shown in config.xml i have cut pasted the JSESSIONID from my browser and 
using it, so its manually done by me after login in web application thru 
firefox. 

I want to set it once in webtest after login and then use it across. 

How is it possible to set cookie in webtest ?

-Amit 

Hi Amit,

why do you want to set the cookie again? Once set, cookies are available
through the whole <webtest> and will be used in further requests.

----- Original Message ----
From: amit shrivas
 <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, March 16, 2007 3:06:51 AM
Subject: How to set JESSIONID cookie header after storing cookie..

Hi,

I am testing a web application and storing cookie after login as:

<storeCookie name="JSESSIONID" property="cookie" />
<verifyCookie name="JSESSIONID" text="#{cookie}" />

Verification is also done properly, now i want to set this cookie in header 
something like

<header name="Cookie" value="JSESSIONID=4EA91ED4FEF3245652F40FEC887B6B8C"/> 

So that i can run a set of test cases on subsequent pages with this session, 
how can i achieve this ?

I was looking at 

 <storeHeader description="store cookie"   name="Content-Type" 
property="contentType" />

Option but this in documents it says: The name of the Http Response
 Header of interest. If the property name
is not specified, the header name is used as key to store the value
found. this i think is more on HTTP response header. 

Please help, since i tried lot of different options and failed.

-Amit 





We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.






Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.





 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

Reply via email to