Re: HtmlUnit
- From: "Phlip" <phlipcpp@xxxxxxxxx>
- Date: Thu, 13 Oct 2005 03:39:24 GMT
kalensr wrote:
> Recently I have been working with Junit and HttpUnit. I have
> successfully implemented a suite of tests and I am pleased with the
> results.
>
> However, in my R&D I came across HtmlUnit
> http://htmlunit.sourceforge.net/ and I am very interested in moving
> forward with this API.
>
> I have found very few examples and no user groups that discuss the
> usage of HtmlUnit.
>
> I am looking for someone who has experience writing tests with HtmlUnit
> or someone who can direct me to other resources. I have come across a
> few road blocks early on in my exploration of HtmlUnit.
Samie, Pamie, Watir, JSUnit, Selenium, and HttpUnit are its competition,
among many others.
HtmlUnit is an interesting concept. Some of those testers live in Internet
Explore and operate its DOM and/or JavaScript. HttpUnit mocks a web browser,
and feeds raw HTTP to a web server. HtmlUnit, IIRC, only reads HTML. If so,
it leaves HTTP out of the loop (and hence also the CGI/Servlet layer), and
it works by interpretting the HTML. It mocks a web browser, and allows
high-level queries into the objects that a web browser would have rendered.
Now let's throw another hat in the fire. Suppose your HTML is pure XHTML
(which is a very good idea, never ever to rely on "browser forgiveness").
Then you can use XPath for high-level queries of the HTML contents.
//textarea/[text()='sauromatians'] will only return a node if it finds a
<textarea> element containing that text.
All these tools are fun to use, and many can propel development very easily.
Don't use them to avoid writing low-level tests. Directly testing the
function that supplies "sauromatians" for that <textarea> has many benefits
over testing that the HTML layer generated the correct <textarea>, /and/ an
HTTP server transmitted it, AND a web browser collected it, /AND/ its DOM
layer rendered it correctly.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
.
- References:
- HtmlUnit
- From: kalensr
- HtmlUnit
- Prev by Date: HtmlUnit
- Next by Date: Testing thesis
- Previous by thread: HtmlUnit
- Next by thread: Re: HtmlUnit
- Index(es):
Relevant Pages
|