StrutsTestCase: Drilled-down Testing for Struts-based Java Apps
This article demonstrates both mock testing and in-container testing of Web-based applications built with the Struts Model-View-Controller framework. StrutsTestCase, a small testing library that builds on top of the JUnit testing framework, allows you to perform both testing methodologies on Struts applications.
by Wellie Chao
February 19, 2004
ou can verify that your Web-based Java application accepts the proper inputs from the HTTP request stream and displays the proper results to the HTTP response stream by performing black box testing with HttpUnit. However, since black box testing essentially simulates a Web browser, the testing code interacts with the application code via HTTP communications, which hides the implementation details.
Unit testing, in contrast, focuses on these little details in the application code. When isolating and fixing bugs, seeing the implementation details that unit testing provides can be very useful. You can use HttpUnit for unit testing, but only when testing standard servlets. It doesn't support the popular Struts Model-View-Controller (MVC) framework. For unit testing on Struts applications, you need StrutsTestCase, a small testing library that builds on top of the JUnit testing framework. With StrutsTestCase, you can actually access the server environment and fiddle with settings and inputs at a much more granular level than with black box testing. You also can access the server environment after the response.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!