[Webtest] Dealing with browsers?

rune@runemolden.com rune@runemolden.com
Thu, 10 Jan 2008 11:31:06 +0100


Hi,

I really enjoy WebTest as a test framework for running browser =20
simulated tests for web applications, but I have experienced some =20
issues which I will address in this post.

I'm trying to define a different browser than the default one, but =20
this feature doesn't seem to work as expected.
My config file is like this:
<config
=09host=3D"the name of the server I'm running the against"
=09port=3D"80"
=09protocol=3D"http"
=09basepath=3D""
=09summary=3D"true"
=09saveresponse=3D"true"
=09resultfile=3D"${wt.resultfile}"
=09resultpath=3D"${wt.resultpath}"
=09haltonfailure=3D"false"
=09haltonerror=3D"false"
=09autorefresh=3D"true"
>
=09<header name=3D"User-Agent" value=3D"Mozilla/4.0 (compatible; MSIE 6.0; =
=20
Windows NT 5.1; Hotbar 3.0)" />
         <!-- List of User-Agents: =20
http://www.user-agents.org/index.shtml?moz -->
=09<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_15=
51.
    [config]  INFO (com.canoo.webtest.engine.Configuration) - Using =20
browser version (Microsoft Internet Explorer, 4.0 (compatible; MSIE =20
6.0b; Windows 98), Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; =20
Hotbar 3.0), 1.2, 6.0). If the javascript support is not as expected, =20
then it's time to go into the sources
    [config]  INFO (com.canoo.webtest.engine.Configuration) - =20
Configuring 2 HTTP header field(s)
    [config]  INFO (com.canoo.webtest.engine.Configuration) - Skipped =20
User-Agent header as it has already been configured in the =20
BrowserVersion
    [config]  INFO (com.canoo.webtest.engine.Configuration) - =20
Configured header "accept-encoding": gzip,deflate
[...]

The access log on the web server says that the User-Agent field in the =20
HTTP header is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; =20
Hotbar 3.0)" for all requests the tests executed generate, which is =20
correct according to what I declared in my <config> section.

The issues I'm pointing at here is the strange logging information =20
WebTest yields in the console. The logging information WebTest yields =20
is very confusing and doesn't really tell what's going on. I really =20
miss some good documentation concerning how to simulate different =20
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 =20
reply on this post. I also believe the project team developing and =20
documenting WebTest should develop some additional documentation on =20
this topic and refactor the WebTest code in order to define less =20
confusing log entries. I know that WebTest uses HtmlUnit in order to =20
simulate browsers, but I still believe these issues are within the =20
scope of their work.

Kind regards,
Rune