Java Reference
In-Depth Information
Chapter 6. Testing Your Applications
We have now reached a good mix of technologies in our example project; this in-
cludes some of the key building blocks of Java EE (except for Java Messaging, which
will be discussed in the next chapter). Besides developing applications, one of the
most common requests among developers is the ability to execute test cases against
applications deployed on a managed (or remote) application server. In this chapter,
we will describe the JBoss AS framework named Arquillian that promises to be the
standard integration testing framework of enterprise applications.
In this chapter, we will more specifically look at:
• An introduction to enterprise testing: from mock objects to the Arquillian
framework
• How to integrate an Arquillian test case for your Ticket Machine application
• How to use the Eclipse IDE and the Maven shell to run Arquillian unit test-
ing
Unit testing and integration testing
The word "testing" offers room for several interpretations; basically, testing requires
verifying the application's basic functionalities. However, there can be different types
of tests depending on what you are testing and what environment you are using for
testing.
The most common type of test is called a unit test and can be defined as a test writ-
ten by the programmer to verify that a relatively small piece of code is doing what it
is intended to do. Unit tests are narrow in scope; they should be easy to write and
execute, and their effectiveness depends on what the programmer considers to be
useful. These tests are intended for the use of the programmer; they are not direc-
tly useful to anybody else, though, if they do their job, testers and users downstream
should benefit by seeing fewer bugs.
A more advanced type of test is called the integration test . Integration tests are done
to demonstrate that different pieces of the system work together; since they cover
whole applications, they require much more effort to put together. For example, they
usually require resources such as database instances and hardware to be allocated
Search WWH ::




Custom Search