![]() | ![]() |
Apache > Jakarta > Cactus > Writing Tests | Docs for: v1.7.2 | v1.7 Last update: November 26 2008 |
IntroductionThis document explains how to unit test EJBs with Cactus. It is divided in 2 parts:
EJB unit testing works with Cactus 1.0 or later.
General ConceptsWhy use Cactus for testing EJBs?You might be wondering why you would use Cactus to unit test your EJBs whereas you could use standard JUnit test cases. Indeed, you could write a standard JUnit test case and view your code as client side code for the EJB to test ... There are actually a few reasons to choose Cactus instead:
The process
You can unit test your EJBs from any of Cactus redirectors:
This means that you would write a test case class that extends any of Cactus redirectors, get a home reference to your EJB, create an instance of it, call the method to test and perform asserts on the result. It is that simple ! What is slightly more complex is the deployment of your EJBs to your EJB container but you should be familiar with this, right? J2EE RI TutorialThis J2EE RI tutorial is a step by step guide for writing Cactus EJB unit test for the Sun J2EE RI server. |