Skip navigation.

In-Container Testing with JUnit

In-Container Testing with JUnit

Today, unit testing is a very popular technique for ensuring code quality. Thanks to the JUnit framework, it has become quite easy to write unit tests for simple Java applications. However, where real-world enterprise applications are concerned, the typical JUnit testXXX() method will not be as helpful because those applications require that objects run inside a container.

In this article, I will describe the application of in-container testing in order to make JUnit tests access objects running inside a J2EE container. The example used here is a Struts-based Web application, which is fairly common among enterprise applications, but the techniques discussed are relevant to any J2EE project.

Learn how in-container testing with JUnit is superior to mock objects for integration testing, how to apply that technique using Oracle JDeveloper.

Author: Julien Dubois
Published: Oracle Technology Network, August 2004