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".
- 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:
Published by deri58
Latest update on March 21, 2013 at 09:51 AM by deri58.