Java Reference
In-Depth Information
Chapter 15. Testing and EJB
This chapter covers
• Different testing strategies
• Unit testing EJBs
• Integration testing EJBs with the embedded EJBContainer
• Integration testing EJBs with Arquillian
• Using CDI in tests
In the previous chapters, we've focused on learning the different technologies EJB 3 has to
offer and showcasing examples of those technologies so you understand how to use them
and apply them in your own applications. But now that you know how to use the techno-
logies, how do you guarantee they're going to fulfill your business requirements, operate
securely and accurately, and give a positive user experience? You do this with testing.
This chapter covers some of the basics of testing EJB technologies. We'll start by discussing
what the different testing strategies are and how they fit into testing EJBs. Next, we'll look
at using technologies such as the embedded EJBContainer and Arquillian for more real-
world tests. Finally, we'll present some common testing problems to avoid so your testing
can be more effective. Let's start by introducing testing.
15.1. Introducing testing
Software testing is usually a heated topic because all developers agree testing is necessary
and beneficial, but we disagree on the best way to do it. In this chapter we're going to look
at the three general strategies for software testing: unit testing, integration testing, and func-
tional testing. Each of these strategies will test your software in different ways, and each
will have pros and cons associated with them. Finding a good balance among these three is
usually the approach organizations take when developing a software testing strategy. So let's
take a look at these testing strategies.
Search WWH ::




Custom Search