Programming Tutorials

Interview Question: Does Struts include its own unit tests?

By: Ash in Interview Tutorials on 2008-08-13  

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.

 

 

 

 





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Interview )

What is difference between Java Bean and Enterprise Java Bean?

Interview Question: What is the difference between sessioncontext and entitycontext?

Interview Question: What are the call back methods in Entity bean?

Types of Interviews

Getting started with Interview

Interview Question: What is the difference between Message Driven Beans and Stateless Session beans?

Is Iterator a Class or Interface? What is its use?

Interview Question: What is the difference between find and select methods in EJB?

Interview Question: What is the difference between JavaBean and EJB?

Explain the user defined Exceptions?

Interview Question: What is the difference between ejbCreate() and ejbPostCreate?

Interview Question: What is difference between EJB 1.1 and EJB 2.0?

Interview Question: Is Decorator an EJB design pattern?

Interview Question: What is abstract schema?

How to define an Interface?

Latest Articles (in Interview)