Hi,
normally cookies are handled transparently, just like in real browsers.
Why do you want to set the cookie by yourself?
Marc.
PS: your application specific error messages don't help ;-(
bat wrote:
hello,
i'm new to webtest, too, and seem to have a similar problem.
i am trying to test a registration process that consists of several steps.
upon entering the start page, a cookie ist set.
whenever the user wants to navigate through the registration, a check is
made against the stored cookie.
if the check fails, the user is transferred back to the start page.
my problem is that i can't seem to get the cookie properties set correctly
in my testscript, so i never even reach page 2.
to avoid any misunderstanding: what would be the content to be used for
"cookie value"?
is my understanding correct that the <groovy>-part can be used without any
precondition?
is the generated cookie automatically applied to any future request during
the current <webtest>?
btw: in my testcase, the check seems to fail, but obvoiusly the redirect
does not work either.
the response.html displays the following instead:
System.NullReferenceException: Object reference not set to an instance of an
object. at Subscription_SC.MasterData1.createBackurl(Subscription
objSubscription) at Subscription_SC.MasterData1.Page_Load(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain()
thanks a lot in advance
bat
Marc Guillemot wrote:
Concerning your tests
- each time you run a test you will have no cookie and therefore simulate
a new user.
- to simulate a visitor that visit again within 30 days, you will need to
generate a cookie as first step of your test. There is no step doing this
currently but a small script can do the work:
<webtest>
...
<steps>
<groovy>
def cookie = new org.apache.commons.httpclient.Cookie("your domain",
"cookie name", "cookie value")
step.context.webClient.webConnection.state.addCookie(cookie)
</groovy>
...
</steps>
</webtest>
See:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/Cookie.html
for details about various cookie constructors
If you identify registered users with cookies to, then a similar setup can
be done.
Marc.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest