Interview Question: Does Struts include its own unit tests?

By: Ash Printer Friendly Format    

Question:Does Struts include its own unit tests?

Answer:

Struts currently has two testing environments, to reflect the fact that some things can be tested statically, and some really need to be done in the environment of a running servlet container.

For static unit tests, we use the JUnit framework. The sources for these tests are in the "src/test" hierarchy in the source repository, and are executed via the "test.junit" target in the top-level build.xml file. Such tests are focused on the low-level functionality of individual methods, are particularly suitable for the static methods in the org.apache.struts.util utility classes. In the test hierarchy, there are also some "mock object" classes (in the org.apache.struts.mock package) so that you can package up things that look like servlet API and Struts API objects to pass in as arguments to such tests.

Another valuable tool is Struts TestCase which provides a useful harness for Action classes that can be used with JUnit or Cactus.

 

 

 

 



Most Viewed Articles (in Interview )

What is Collection API?

Interview Question: What is Action Class?

Interview Question: What is Struts Validator Framework?

Interview Question: What is ActionForm?

Interview Question: Is Struts compatible with other Java technologies?

Interview Question: Do you have to credit Struts on your own website?

Interview Question: How do I install Struts?

Interview Question: What about JSTL and JavaServer Faces ?

Interview Question: Can i map more than one table in a CMP?

Interview Question: How many EJB Objects are created for a Bean?

Interview Question: What is Message Driven Bean?

Interview Question: Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?

Types of Interviews

Question: What is a Hidden Comment in JSP?

Question: What is an output comment in JSP?

Latest Articles (in Interview)

Comment on this tutorial