A few words of thanks would be greatly appreciated.

StrutsTestCase Testing Framewok (Part 1): Introduction

The StrutsTestCase testing framework of Java JEE applications is an extension of the standard JUnit testing framework. The legacy of the TestCase class allows the testing of codes based on the Struts framework. StrutsTestCase is based on two different approaches to test the Struts code:
  • by running the ActionServlet is in a real environment with a standard servlet
  • by running it in a standard simulation environment.

We refer to these two approaches as:
  • The in-container approach.
  • The Mock Object approach

StrutsTestCase make use of the ActionServlet controller to test code, thus offering numerous testing possibilities:
  • Implementation of "Action".
  • FormBeans
  • Forward statements and associated path
  • Error messages returned by the actions. '

Moreover, StrutsTestCase already provided validation methods (assertEquals, assertNotNull, ...) to make unit testing more thorough, quick and easy.
StrutsTestCase is hosted on SourceForge on this link.
As mentioned above, most common approaches to test the server-side classes are:
  • Mock objects: class test this approach by simulating the server container.
  • In-container: testing the classes,by running them in real servlet container.

StrutsTestCase allows you to switch from one approach to another, with a minimal impact on test classes. In fact, the configuration and validation methods are exactly the same for both approaches.
StrutsTestCase provided two base classes:
  • MockStrutsTestCase: It uses HttpServlet to simulate the container.
  • CactusStrutsTestCase: It uses the cactus test framework to test the Struts classes in a container of real server

The StrutsTestCase framework is made up of the following libraries:

  • strutstest-2.1.3.jar
  • junit-3.8.1.jar
  • ant-junit.jar

  • cactus-ant-1.7.2.jar
  • httpunit-1.6.jar
  • nekohtml-0.9.1.jar
  • commons-logging-1.0.4.jar"
  • commons-httpclient-2.0.2.jar

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « StrutsTestCase Testing Framewok (Part 1): Introduction », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!