HttpUnit 1.6 released


News: HttpUnit 1.6 released

  1. HttpUnit 1.6 released (6 messages)

    The latest version of HttpUnit is now available, with dozens of enhancements and bug fixes, including:

    • Total reworking of frame handling
    • Enhanced support for proxy servers and JavaScript
    • Numerous convenience methods for manipulating forms and controls
    • ServletUnit support for filters and listeners
    What is HttpUnit
    Automated testing is a great way to ensure that code being maintained works. The Extreme Programming (XP) methodology relies heavily on it, and practitioners have available to them a range of testing frameworks, most of which work by making direct calls to the code being tested. But what if you want to test a web application? Or what if you simply want to use a web-site as part of a distributed application?

    In either case, you need to be able to bypass the browser and access your site from a program. HttpUnit makes this easy. Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.

    The same techniques used to test web sites can be used to test and develop servlets without a servlet container using ServletUnit, included in the download.
    Visit the home page for: HttpUnit

    HttpUnit Cookbook
  2. One suggestion to HttpUnit is that it should support using real browser as client. One good example is Samie, it calls IE directly to connect to the web application, then analyze the returned page. Using real browser can solve a lot of javascript and redirect problems. It makes the test is a "real test" too. FireFox would be a good candidator because it has open API and source is open.
  3. One suggestion to HttpUnit is that it should support using real browser as client.
    I've been using httpunit for about 2 years. I initially looked at some of the scripting based testing tools and found they generally split into two areas.

    1. Tools that record browser sessions and play back the results.
    2. Tools that use configurable scripts to generate traffic.

    The problem I had was that to generate a useful set of web unit tests and needed a lot of power in the scripts... i.e.

    1. Pre-populate data in the database
    2. Access various pages via dynamic id's (i.e. create a customer then go to the customer view page based on the generated customer primary key)

    etc. etc.

    I chose Httpunit because if I'm going to be writing code to generate my unit tests then my preferred language is java, whih by default gives me all the power I need to generate a useful set of tests.

    Ian Purton
    Website Uptime and Availability | Permission Email List Management | Website Traffic Analysis | All Time Top 100 Rock Charts
  4. I have used HTTPUNIT for more than 3 years already. I like its api. The problem I have is that the http client it used has different behavior than Internet Expoloer, especially for the javascript part. When I refactored a javascript-rich web application, it is impossible to use httpunit to do the testing. Samie uses IE directly to access the web page, but it is written in perl. I do not like to write test cases with non-java language, so I only use samie when httpunit can not handle it.

    I know there are many people working on many kind of http clients to simulate the behavior of the broswer. But why not use the real broswer directly instead of wasting the time to simulate the browser. Since Firefox is an open source browser, it is possible to privide java API to control the browser.

    If you can test your application in the real browser, why do you want to go for a simulator?
  5. Han says:Since Firefox is an open source browser, it is possible to provide java API to control the browser. Did anyone try this? (it may have a great commercial impact as developers can automate test(and certify 100% compliance)on open source browsers)
  6. HttpUnit 1.6 released[ Go to top ]

    As an unrelated aside, Rob Davies also pointed me at SysUnit, another jUnit-related project.


    Cameron Purdy
    Tangosol, Inc.
    Coherence: Shared Memories for J2EE Clusters
  7. Good testing framework.[ Go to top ]

    I have used HttpUnit in the past and it's a good framework. I used it for generating http traffic for some load testing and it worked.