Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Test Web applications with HttpUnit

The HttpUnit framework allows the implementation of automated test scripts

In a typical enterprise application, many areas require testing. Starting from the simplest components, classes, the developers or specialized test developers need to program unit tests to ensure that the application's smallest units behave correctly. Each component can potentially pass the unit tests alone; however developers need to ensure they work together as expected—as part of a subsystem, and as part of the whole application—hence, integration tests must be performed. In some projects, performance requirements must be fulfilled, so the quality assurance engineers perform load tests to verify and document how the application performs under various conditions. During application development, quality assurance engineers perform automated and manual functional tests to test the application's behavior from the user's viewpoint. When a development project nearly completes a specific milestone, acceptance tests can be performed to verify that the application fulfilled the requirements.

HttpUnit is a framework based on JUnit, which allows the implementation of automated test scripts for Web applications. It is best suited for the implementation of automated functional tests, or acceptance tests. As the name suggests, it can be used for unit testing; however, typical Web layer components like JSP (JavaServer Pages) pages, servlets, and other template components do not lend themselves to unit testing. As for various MVC (Model-View Controller) framework-based components, these are better suited for testing with other testing frameworks. Struts actions can be unit tested with StrutsUnit, and WebWork 2 actions can be unit tested without a Web container, for example.

Test targets

Before we jump into the architecture and implementation details, it's important to clarify exactly what the test scripts will need to prove about the Web application. It is possible to just simulate the behavior of a casual Website visitor by just clicking on interesting links and reading pages in a random order, but the result of these random scripts would not describe the application's completeness and quality.

A typical enterprise Web application (or a complex Website) has several documents describing the requirements of the various users or application maintainers. These may include use-case specifications, nonfunctional requirements specifications, test-case specifications derived from the other artifacts, user interface design documents, mockups, actor profiles, and various additional artifacts. For a simple application, the whole specification could possibly consist of a simple text file with a list of requirements.

From these documents, we must create an organized list of test cases. Each test case describes a scenario that can be accomplished by a Web visitor through a Web browser. A good practice is to aim for similar-sized scenarios—larger scenarios can be broken down to smaller chunks. Many excellent books and articles discuss the creation of test-case specifications. For this article, let's assume you have a set of items you want to test for your Web application, organized into sets of test-case scenarios.

1 | 2 | 3 | 4 | 5 | 6 |  Next >

Discuss

Start a new discussion or jump into one of the threads below:

Subject Replies Last post
. Drag and Drop
By
0 04/22/08 06:04 AM
by Anonymous
. How do I make each instance a seperate session
By Anonymous
2 04/22/08 06:03 AM
by Anonymous
. How do you run JavaScript???
By Anonymous
3 04/22/08 06:02 AM
by Anonymous
. Test Web applications with HttpUnit
By JavaWorldAdministrator
3 04/22/08 06:02 AM
by Anonymous
. How about testing Java Applets
By Anonymous
1 04/05/08 06:12 PM
by Anonymous
. testing forms in httpunit
By honeymca
3 04/02/08 09:25 AM
by Anonymous


Resources