Controls can be tested either inside of an application container or outside in a standalone Java environment. Testing in a standalone Java environment is especially useful when running unit tests.
Controls can be integrated into the JUnit
test framework using the ControlTestCase
base class. This base class provides a control container and provides help
in instantiating a control declaratively via the
@Control
annotation.
Note that not all controls can be tested within the test container because some controls have requirements beyond what ControlTestCase provides. For example, a control that uses JNDI lookups will not be testable with ControlTestCase. Likewise controls (such as the Service Control) that take a dependency on a J2EE container (such as WebLogic Server) may not be testable out of that J2EE container.
For details on testing controls with ControlTestCase see Control Tutorial: Testing Controls with JUnit.