Forum Discussion

lakshmi's avatar
lakshmi
Occasional Contributor
16 years ago

require groovy script to capture Set Cookie id from HTTP Header table

Hi,

In order to maintain the user session in the test case ,if i copy the Set Cookie, HTTP Header Parameter manually into the subsequent  requests the session is maintained it works fine.

I Need help in creating a groovy-script between the two request that reads the response cookie of the first response and sets the corresponding request cookie in the following request.

Any help would be appreciated.

Thanks,
Lakshmi

3 Replies

  • lakshmi's avatar
    lakshmi
    Occasional Contributor
    Hi,

    This is with reference to my previous post.I am able to see the Http Header Information as shown below.I am not able to write the groovy code to capture the "Set-Cookie" parameter and set the same value in another request.

    HTTP/1.1 200 OK
    X-AspNet-Version: 2.0.50727
    Date: Sat, 28 Jun 2008 13:40:30 GMT
    Content-Length: 86
    Set-Cookie: ASP.NET_SessionId=ycsvh455xliqpj554w2wym45; path=/; HttpOnly
    Content-Type: text/xml; charset=utf-8
    X-Powered-By: ASP.NET
    Server: Microsoft-IIS/5.1
    Cache-Control: private



    Kindly help asap .

    Thanks,
    Lakshmi
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Lakshmi,

    maybe you could just use the "Maintain Session State" option in the TestCase Options dialog, which transfers cookie information between requests?

    regards!

    /Ole
    eviware.com
  • lakshmi's avatar
    lakshmi
    Occasional Contributor
    Hi Ole,

    Thanks for the reply and it simply works great.
    Now i am able to also have an integration test case flow with combinations of different requests and their respective groovy scripts to parse the respective response xmls.

    Thanks again.

    Regards,
    Lakshmi