[Webtest] Question about moving Webtest early release to current release?

Tize Ma webtest@lists.canoo.com
Wed, 13 Jul 2005 18:18:39 -0400


Thanks again, Marc.
After setting the User-Agent attribute in a header tag in the config like
<header name="User-Agent" value="Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3"/>
 and 
<option name="ThrowExceptionOnScriptError" value="false"/>

I am able to go a little further. My new problem is that the Webtest does not like the javascript:
document.body.style.cursor = "wait";
and
elDiv.style.height = lHeight;
elDiv.style.width = lWidth;
Here elDiv is a <div> element.

I got the following errors when encountering these scripts:
[testSpec] EcmaError: lineNumber=[11] column=[0] lineSource=[null] name=[TypeError] sourceName=[scripts/adminUtils.js] message=[TypeError: Cannot set property "cursor" of undefined to "wait" (scripts/adminUtils.js#11)]
 [testSpec] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property "cursor" of undefined to "wait" (scripts/adminUtils.js#11)
[testSpec]     at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:250)
 [testSpec]     at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:718)
 [testSpec]     at com.gargoylesoftware.htmlunit.html.HtmlAnchor.doClickAction(HtmlAnchor.java:103)
 [testSpec]     at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:120)
 [testSpec]     at com.canoo.webtest.steps.request.ClickLink$1.call(ClickLink.java:99)
.....
and

[testSpec] EcmaError: lineNumber=[733] column=[0] lineSource=[null] name=[TypeError] sourceName=[scripts/adminUtils.js] message=[TypeError: Cannot set property
 "height" of undefined to "722" (scripts/adminUtils.js#733)]
 [testSpec] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot set property "height" of undefined to "722" (scripts/adminUtils.js#733)
.....
The stack trace show the exceptions come from the JavaScriptEngine of htmlunit. Does htmlunit support these javascripts? Do I miss some settings/config?
Thanks
Tize

-----Original Message-----
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
Sent: 2005年7月12日 10:44
To: webtest@lists.canoo.com
Subject: Re: [Webtest] Question about moving Webtest early release to current release?

Hi,

you have a js error:
Cannot read property "offsetTop" from undefined (scripts/adminUtils.js#874)

You have to look at the js script to understand on which object the
property offsetTop was read and why htmlunit doesn't find it. I guess
that you didn't have such a problem previously because httpunit didn't
even execute this javascript code.

Marc.

Tize Ma wrote:

> Thank you very much, Marc.
>
> My problem looks similar to that in another message (by Gooshy
> Gooshy). In the section where the step fails I have
>
> <setInputField description="Set the Username"
>
> name="j_username"
>
> value="${admin.username}" />
>
> <setInputField description="Set the password"
>
> name="j_password"
>
> value="${admin.password}" />
>
> <clickButton description="Submit the admin login form"
>
> name="submit1"/>
>
> Those properties are defined in a properties file.
>
> The console output is like:
>
> [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step:
> setInputField "Set the Username" (4/30)
>
> [testSpec] INFO (com.canoo.webtest.engine.Context) - Current form set
> to (action=j_security_check)
>
> [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step:
> setInputField "Set the password" (5/30)
>
> [testSpec] INFO (com.canoo.webtest.steps.Step) - Start Step:
> clickButton "Submit the admin login form" (6/30)
>
> [testSpec] INFO (com.canoo.webtest.steps.request.ClickButton) - ->
> gotoTarget(by input): name=submit1 value=Login
>
> [testSpec] INFO (org.apache.commons.httpclient.HttpMethodDirector) -
> Redirect requested but followRedirects is disabled
>
> [testSpec] INFO (org.apache.commons.httpclient.HttpMethodDirector) -
> Redirect requested but followRedirects is disabled
>
> [testSpec] ERROR (com.canoo.webtest.steps.request.Target) -
> ScriptException: enclosed exception was "Wrapped
> com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot read
> property "offsetTop" from undefined (scripts/adminUtils.js#874)"
>
> [testSpec] INFO (com.canoo.webtest.steps.Step) - Exception thrown from
> this class: com.canoo.webtest.engine.StepFailedException
>
> [testSpec] INFO (com.canoo.webtest.steps.Step) - Message was:
> Step[clickButton "Submit the admin login form" (6/30)]: Script error
> executing at: clickbutton
>
> [testSpec] INFO (com.canoo.webtest.ant.TestSpecificationTask) -
> Writing report using Report class: com.canoo.webtest.reporting.XmlReporter
>
> It looks like the main problem here is that the property "offsetTop"
> is undefined. Somehow, the previous build of Webtest and IE seem to be
> fine with it.
>
> Thanks again.
>
> Tize
>
> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
> Sent: 2005年7月12日 7:32
> To: webtest@lists.canoo.com
> Subject: Re: [Webtest] Question about moving Webtest early release to
> current release?
>
> Hi,
>
> the messages from parser are only informative and not allways very
> good. These parser errors are not the cause of the
>
> failing tests. You have to look at the step that fails and the
> associated messages to find the origin of the problem.
>
> Marc.
>
> Tize Ma wrote:
>
>> Hi, all,
>
>> I am trying to move Canoo Webtest release 457 (httpunit) to 916
>
>> (htmlunit). (Old release works great, but it is probably the time to
>
>> move to the new one) . The problem I face is that all tests that run
>
>> with build 457 do not run now. After I turn on showhtmlparseroutput in
>
>> config, I got a lot of errors like,
>
>> <error col="67" line="5"
>
>> url="http://ReTma:8080/rware/admin/frames.html">Missing whitespace
>
>> before attribute "SCROLLING".</error>
>
>> And much more warnings.
>
>> I experimented with option tag in the config with JavaScriptEnabled to
>
>> false, some errors go away and those steps passed. But there are still a
>
>> lot of similar errors. We do like to use the feature of supporting
>
>> JavaScript in the new release. Therefore turning off JavaScript is a
>
>> dumb idea even if it temporarily solve any problem.
>
>> So my question is, what is the proper way to "upgrade" webtest so that
>
>> the old tests will still work with the new build/release? What causes
>
>> the errors? and how to fix/get around them?
>
>> Thanks a lot.
>
>> Tize
>
> _______________________________________________
>
> WebTest mailing list
>
> WebTest@lists.canoo.com
>
> http://lists.canoo.com/mailman/listinfo/webtest
>

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest