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.

 

 

 

 

Ask a Question



Most Viewed Articles (in Interview )

Interview Question: What is ActionForm?

Interview Question: Is there a particularly good IDE to use with Struts ?

Interview Question: Do ActionForms have to be true JavaBeans?

Interview Question: What is lazy loading?

Interview Question: What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

Question: What is an Expression tag in JSP?

Why J2EE is suitable for the development distributed multi-tiered enterprise applications?

What are the services provided by a container?

Interview Question: What is Struts?

Interview Question: How is the MVC design pattern used in Struts framework?

Interview Question: Who makes the Struts?

Interview Question: Why it is called Struts?

Interview Question: What is Action Class?

Interview Question: Write code of any Action Class?

Interview Question: What is Struts Validator Framework?

Latest Articles (in Interview)

Comment on this tutorial