Java Reference
In-Depth Information
Figure 8.1
Lifecycle of a typical in-container test
and so on), and tests our domain objects (3). The server returns the result from the
tests back to the client (4), which an IDE or Ant or Maven can gather.
8.3.2
In-container testing frameworks
As you just saw, in-container testing is applicable when code interacts with a con-
tainer and tests can't create valid container objects ( HttpServletRequest in the
previous example).
Our example uses a servlet container, but there are many different types of con-
tainers: servlet, database, OSG i, SIP , and the like. In all of these cases, we can apply the
in-container testing strategy. In the third part of the topic, we present different open
source projects that use this strategy. Table 8.1 lists the types of containers and the test-
ing frameworks we use in later chapters.
Although the open source world offers other projects, we cover the more mature proj-
ects listed in the table. Next, we compare stubs, mock objects, and in-container testing.
Table 8.1
Containers and testing frameworks
Container type
In-container testing framework to use
Chapter with detailed description
HTTP container
Cactus (for testing servlets, JSPs, tag
libraries, filters, and EJBs)
Chapter 14
HTTP container
JSFUnit (for testing JSF components)
Chapter 15
OSGi container
JUnit4OSGi (for testing OSGi modules)
Chapter 16
Database container
DBUnit
Chapter 17
 
 
 
 
 
 
Search WWH ::




Custom Search