HtmlUnit 1.4 Released


News: HtmlUnit 1.4 Released

  1. HtmlUnit 1.4 Released (11 messages)

    HtmlUnit is a Java unit testing framework for testing web based applications, allowing you to interact with your web application at a high level by dealing with documents, rather than requests and responses. HtmlUnit also contains an advanced implementation of the JavaScript DOM objects, including IE-only features for those who need them.

    HtmlUnit supports the vast majority of HTTP user-agent constructs, including cookies, HTTPS, JavaScript, DOM, forms and proxies.

    For information on getting started, see this page.

    If you want to verify that a particular JavaScript property or method is supported before trying HtmlUnit, please see this page.

    If you find that HtmlUnit does not fit your requirements, you might want to drop us a note about it and then check out HttpUnit.

    Threaded Messages (11)

  2. Testing web applications[ Go to top ]

    I compiled a list of open source testing tools for Java web applications:
  3. Enterprise Web Test[ Go to top ]

    You may add Enterprise Web Test : to your list. It's very similar to HTTP Unit but it uses IE ActiveX control as the user agent. It allow you to plug any browser as the user agent (you just need to write some glue code). Because it use a real browser, you have complete Javascript functionality.

    The only problem is that the project seems to be staled since April 2003.
  4. It would be nice if a comparsion between HttpUnit and HtmlUnit
  5. It would be nice if a comparsion between HttpUnit and HtmlUnit

    There is no formal comparison that I am aware of, but my personal experience was as follows. At work we needed either HtmlUnit or HttpUnit to work on real-world sites with broken HTML and proprietary JavaScript that we had no control over. Judging by the number of search results on Google, HttpUnit seemed to be the most popular, but we went with HtmlUnit because they seemed to have a more involved developer team and the JavaScript host objects seemed to be more mature. Indeed, after a couple of weeks and a dozen patches submitted and then applied, we have never looked back. What this means is that as of HtmlUnit 1.4 / HttpUnit 1.6 I can say that the JavaScript implementation in HtmlUnit is more complete.

    As for everything else, I imagine they're pretty close. They both use NekoHTML to normalize the incoming HTML (though HttpUnit allows you to switch to JTidy, if I remember correctly). They both use Rhino (a Mozilla project) to interpret JavaScript. HtmlUnit uses HttpClient (from Apache Jakarta Commons) to communicate with webservers, while HttpUnit implements its own request/response backend, which may give HtmlUnit a little bit of an edge behind the scenes. HttpUnit does contain a mock servlet container of which there is no equivalent in HtmlUnit.

    It really comes down to your use case, whether you like to deal with response/request objects or documents, and whether you need the extra servlet functionality.
  6. Have you tried JExplorer og JDIC, which both wraps the browser (IE) and basically offers the same functionality as HtmlUnit and HttpUnit.

    Using a browser-wrapper solves the problems with non-valid HTML, cookies, forms etc. in the sense, that these problems are left to the browser and not the Java-code to solve.

  7. HtmlUnit 1.4 Released[ Go to top ]

    We are starting to use HTTPUnit to test our application. We didn´t know anything abut HTMLUnit, so we will take a look on it.
    We work with frames, and it´s more complicated. How about frames and HTMLUnit? Does anybody know?

    AND We are planning to make a tool to describe the test with XML, so we can indicate what to test in a descriptive way. I suppose it could be portable beetwen HTTPUniut and HTMLUnit.

    We could write in XML:
      <test action="">
        <response there-is="title" value="some-title"/>
        <response there-is="frame" value="frameName"/>
        <child-frame name="frameName">
          <response there-is="alert" value="some-message"/>

    We would like to know if there is some project like this, or would it be interenting to create it in sourceforge, for example?

  8. HtmlUnit 1.4 Released[ Go to top ]

    Hey Jose,

       Don´t try to re invent the wheel! :-)
       We already have such a tool!
       Try the Canoo Web Test framework at:

    Hope that helps!
  9. HtmlUnit 1.4 Released[ Go to top ]

    Thanks Fabio!
    It seems to be what we need!!! We will try it.

  10. HtmlUnit 1.4 Released[ Go to top ]

    If you are looking to write test scripts in XML, HtmlUnit comes with a Jelly wrapper that allows you to do so. See this page for more information.
  11. HttpUnit & JWebUnit[ Go to top ]

    HttpUnit is great. Thanks for the update. I use JWebUnit ( as a great wrapper around the apis to simplify it even further.

    Keep up the good work.
  12. HtmlUnit 1.4 Released[ Go to top ]

    good ;-)