3 messages in com.canoo.lists.webtestRe: [Webtest] Re: Cookie Handling
FromSent OnAttachments
Jacob Portnoy17 Dec 2004 09:23 
Ian Wallace17 Dec 2004 09:59 
HUR...@Nationwide.com17 Dec 2004 10:04 
Subject:Re: [Webtest] Re: Cookie Handling
From:HUR...@Nationwide.com (HUR@Nationwide.com)
Date:12/17/2004 10:04:28 AM
List:com.canoo.lists.webtest

I find your cookie problems very interesting since I am having cookie problems in my testspec as well.

I am still not clear on your problem though. In your case, what would you choose as the symptoms of your problem:

1) The server does not issue a Set-Cookie header. 2) The browser does not set the cookie. 3) The browser does not return a Cookie header to the server. 4) The server ignores the Cookie header sent by the browser.

In my case, the server issues the cookie (containing a unique user-defining value), my Webtest client sets the cookie correctly, and sends it back in a cookie header with each request, (so far so good), but then the server ignores the cookie header that the browser sent and reissues a Set-Cookie header with a new user-defining value.

It just seems like my server ignores every cookie header sent by Webtest. Since my testspec pages rely on client variables that are keyed to the browser cookie, my testspec pages fail.

I have been having an ongoing discussion with Marc Guillemot about the three different cookie compatibility modes availble in HTTPClient inside of HTMLUnit. Being able to set a different mode may solve my cookie problem (and maybe not). Normally, it is possible to choose a particular mode by setting a system property, but it is not possible to change the mode in Webtest since HTMLUnit 'locks down' the cookie mode by overwriting the value set by the system property. Marc wants to stop HTMLUnit from controlling this setting. Once Marc gets an updated HTMLUnit jar into Webtest, maybe we can both try some of these other cookie modes and see if anything changes.

Jerry

"Jacob Portnoy" <jpor@checkernet.com>

Sent by: webt@gate2.canoo.com

12/17/2004 11:23 AM Please respond to webtest

T To: <webt@gate2.canoo.com> cc:

bcc: Subject: [Webtest] Re: Cookie Handling

Although it may seem that I am using multiple testspecs, I am only using one testspec with multiple page hits.

In a nutshell, I have a login.jsp page which requires 2 cookies to be present at the client-level. In order to accomplish this, I have my testspec hit home.jsp which transfers the cookies to the client. The testspec then navigates to login.jsp with the appropriate cookies. I have changed log4j.properties to be in debug-mode, and I can see that the cookies are accepted when they originally hit home.jsp. However, they are not stored so that they can be used on login.jsp.

I found the following page which explains how to use "storeCookie" : http://webtest-community.canoo.com/wiki/space/CookieSteps

On this page, it describes how "text" must be set to "#(sessioncookie)" (which makes sense because the ID for the cookie changes per session basis). However, when I try to build the .xml, it comes back with the following error:

com.canoo.webtest.engine.StepFailedException: Wrong cookie "cookieName" value found! Expected "#{sessioncookie}" but got "SessionIDNumber"

Does anybody know how to have HTTPUnit register "#(sessioncookie)" as a session variable, rather than taking it as a literal string?

--------------- Jacob Portnoy Checkerboard LTD 508-438-2182 JPor@Checkernet.com www.Checkernet.com