1 message in com.canoo.lists.webtest[Webtest] Problems with cookies and l...
FromSent OnAttachments
Chris Pudney15 Nov 2004 20:12 
Subject:[Webtest] Problems with cookies and latest (HtmlUnit) WebTest build
From:Chris Pudney (webt@focal-technologies.com)
Date:11/15/2004 08:12:34 PM
List:com.canoo.lists.webtest

G'day,

I'm migrating our test suite to the latest build of WebTest and am having problems where cookies are used.

Previously, I used the following to define a couple of cookies:

<config...> ... <header name="Cookie" value="user=XXX&amp;YYY; client=installed&amp;1" /> ... </config>

This worked perfectly with earlier builds based on HttpUnit.

With the latest HtmlUnit-based build (548) of WebTest I get the following:

... [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step: null "[implict setup step]" (1/12) [testSpec] DEBUG (com.canoo.webtest.steps.Step) - Executing null ([implict setup step]) [testSpec] DEBUG (com.canoo.webtest.engine.Configuration) - Headers: [com.canoo.webtest.engine.Header@39e5b5, com.canoo.webtest.engine.Header@117f31e] [testSpec] DEBUG (com.canoo.webtest.engine.Configuration) - Not User-Agent header: Cookie [testSpec] DEBUG (com.canoo.webtest.engine.Configuration) - Found User-Agent header: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) [testSpec] INFO (com.canoo.webtest.steps.Setup) - Using browser version (Microsoft Internet Explorer, 4.0 (compatible; MSIE 6.0b; Windows 98), Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0), 1.2). If the javascript support is not as expected, then it's time to go into the sources [testSpec] INFO (com.canoo.webtest.steps.Setup) - Configuring http headers (2 elts) [testSpec] INFO (com.canoo.webtest.steps.Setup) - Configured header "Cookie": user=XXX&YYY; client=installed&1 [testSpec] INFO (com.canoo.webtest.steps.Setup) - Skipped User-Agent header as it has already been configured in the BrowserVersion [testSpec] DEBUG (com.canoo.webtest.steps.Step) - Finished null ([implict setup step]) [testSpec] DEBUG (com.canoo.webtest.steps.Step) - Completed Step: null "[implict setup step]" (1/12) [testSpec] DEBUG (com.canoo.webtest.steps.Step) - Successful Step: null "[implict setup step]" (1/12) ...

Then a redirect request is generated indicating that the cookie has not actually been sent with the request.

The important lines from above appear to be

[testSpec] DEBUG (com.canoo.webtest.engine.Configuration) - Not User-Agent header: Cookie

and

[testSpec] INFO (com.canoo.webtest.steps.Setup) - Configured header "Cookie": user=XXX&YYY; client=installed&1

Am I setting Cookies correctly?

Any guidance would be appreciated.

Thanks, Chris.