Wednesday, December 6, 2006

HtmlUnit - unit testing framework for web applications

HtmlUnit is a java unit testing framework for testing web based applications. It is similar in concept to httpunit but is very different in implementation. Which one is better for you depends on how you like to write your tests.
HttpUnit models the http protocol so you deal with request and response objects. HtmlUnit on the other hand, models the returned document so that you deal with pages and forms and tables.

HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit.

Features
Support for the HTTP and HTTPS protocols. ( JSSE must be in your classpath in order to use HTTPS support)
Support for cookies
Ability to specify whether failing responses from the server should throw exceptions or should be returned as pages of the appropriate type (based on content type)
Support for submit methods POST and GET
Ability to customize the request headers being sent to the server
Support for html responses
o Wrapper for html pages that provides easy access to all information contained inside them
o Support for submitting forms
o Support for clicking links
o Support for walking the DOM model of the html document
Proxy server support
Support for basic authentication
Partial support for javascript (see javascript section below)

JavaScript support
Starting with the 1.1 release, HtmlUnit is supporting javascript. The core javascript language is already fully supported by the Rhino javascript engine.

http://htmlunit.sourceforge.net/


Digg This Article Bookmark The Article On Delicious Bookmark at YahooMyWeb Bookmark at reddit.com Bookmark at NewsVine Fark this

No comments:

Total Pageviews

Reading List - 05-Mar-23

Talking to #AI may be the most important job skill of this century ( JohnGoodPasture ) Role of account management over the years. It’s a ro...