[Webtest] Dealing with browsers?
rune@runemolden.com
rune@runemolden.com
Thu, 10 Jan 2008 14:40:41 +0100
Hi,
Thanks for your quick response.
I changed to build 1646, but I can't see any difference. I guess the =20
header part worked as it should in the build of WebTest I used =20
previously. The log output is still the same, but the web server log =20
says that the User-Agent field of the HTTP Request Header is equal to =20
the one defined in the header-section of the config.xml file. So I =20
guess the header tweaking has been working in proper way the entire =20
way for may part, but I was fouled by the log output in the console.
I have another problem (was also a problem befor I upgraded to build =20
1646 of WebTest):
I'm trying to run tests against a web application simulating =20
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)". I get the =20
following warnings:
[clickButton] WARN =20
(com.gargoylesoftware.htmlunit.javascript.host.Window) - =20
window.alert("ServerComm: undefined") no alert handler installed
[clickButton] WARN =20
(com.gargoylesoftware.htmlunit.javascript.host.Window) - =20
window.alert("fnLogin: undefined") no alert handler installed
Does this say that htmlunit is unable to handle JavaScript alert dialogs?
This exactly the same alerts I'm getting when I run Mozilla Firefox =20
(real browser) manually, but I do not get these errors when I'm =20
running IE 6.0 (real browser) manually.
I'm running WebTest on Ubuntu Linux 7.10 Gutsy Gibbon. I don't know if =20
that might have any impact on how browser simulation performs.
Kind regards,
Rune
Quoting Robert Bodziony <robert.bodziony@gmail.com>:
> hi
> using latest? build 1646 config headers works :)
> Regards,
> Robert
>
> 2008/1/10, rune@runemolden.com <rune@runemolden.com>:
>>
>> Hi,
>>
>> I really enjoy WebTest as a test framework for running browser
>> simulated tests for web applications, but I have experienced some
>> issues which I will address in this post.
>>
>> I'm trying to define a different browser than the default one, but
>> this feature doesn't seem to work as expected.
>> My config file is like this:
>> <config
>> host=3D"the name of the server I'm running the against"
>> port=3D"80"
>> protocol=3D"http"
>> basepath=3D""
>> summary=3D"true"
>> saveresponse=3D"true"
>> resultfile=3D"${wt.resultfile}"
>> resultpath=3D"${wt.resultpath}"
>> haltonfailure=3D"false"
>> haltonerror=3D"false"
>> autorefresh=3D"true"
>> >
>> <header name=3D"User-Agent" value=3D"Mozilla/4.0 (compatible; MSI=
E 6.0
>> ;
>> Windows NT 5.1; Hotbar 3.0)" />
>> <!-- List of User-Agents:
>> http://www.user-agents.org/index.shtml?moz -->
>> <header name=3D"accept-encoding" value=3D"gzip,deflate" />
>> </config>
>>
>>
>> The webtest log yields the following:
>> [...]
>> [webtest] INFO (com.canoo.webtest.ant.WebtestTask) - Canoo Webtest:
>> R_1551.
>> [config] INFO (com.canoo.webtest.engine.Configuration) - Using
>> browser version (Microsoft Internet Explorer, 4.0 (compatible; MSIE
>> 6.0b; Windows 98), Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
>> Hotbar 3.0), 1.2, 6.0). If the javascript support is not as expected,
>> then it's time to go into the sources
>> [config] INFO (com.canoo.webtest.engine.Configuration) -
>> Configuring 2 HTTP header field(s)
>> [config] INFO (com.canoo.webtest.engine.Configuration) - Skipped
>> User-Agent header as it has already been configured in the
>> BrowserVersion
>> [config] INFO (com.canoo.webtest.engine.Configuration) -
>> Configured header "accept-encoding": gzip,deflate
>> [...]
>>
>> The access log on the web server says that the User-Agent field in the
>> HTTP header is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
>> Hotbar 3.0)" for all requests the tests executed generate, which is
>> correct according to what I declared in my <config> section.
>>
>> The issues I'm pointing at here is the strange logging information
>> WebTest yields in the console. The logging information WebTest yields
>> is very confusing and doesn't really tell what's going on. I really
>> miss some good documentation concerning how to simulate different
>> kinds of browser during tests, how to do this in a proper way etc.
>>
>> If anyone has some experience with this, please to not hesitate to
>> reply on this post. I also believe the project team developing and
>> documenting WebTest should develop some additional documentation on
>> this topic and refactor the WebTest code in order to define less
>> confusing log entries. I know that WebTest uses HtmlUnit in order to
>> simulate browsers, but I still believe these issues are within the
>> scope of their work.
>>
>> Kind regards,
>> Rune
>>
>> _______________________________________________
>> WebTest mailing list
>> WebTest@lists.canoo.com
>> http://lists.canoo.com/mailman/listinfo/webtest
>>
>