Ant can be used to automate an EjbUnitTest, but there are several possible approaches, most centering on custom extensions to Ant.
There's been discussion on the ant-user mailing list
( http://marc.theaimsgroup.com/?l=ant-user&r=1&w=2 )
under the threads "Weblogic and Junit", "
So far, there seem to be four different approaches:
"ant build
startWebLogic.sh &
sleep 20
ant test
stopWebLogic.sh
sleep 20"
All of these tasks centre around using WebLogic for development and testing. One of the major reasons for this is that WebLogic does not properly support dynamic (re)loading of classes, especially EAR files (see WebLogicGripes for more on this). This means that, for most practical purposes, you end up needing to stick the classes on WebLogic's system class path, which in turn means that you need to restart WebLogic whenever you want to change those classes. (This bug is meant to be fixed in 6.1, which is slated for a June/July release)
There are appservers out there that properly support dynamic loading and reloading of classes. OrionServer, in particular, looks promising to me at this time. With such an appserver, you leave the server running all the time (just as you leave your database running all the time), then simply build the EJB/EAR and deploy it (usually by copying the file into a deploy directory). The other advantage of it, of course, is that you can stick a copy on every developer's box. -- RobertWatkins.
I've done exactly that, with OrionServer on every developer's box, in a previous project. It worked out very well, but I would have preferred to use mock objects instead of a full J2EE server to avoid the startup time. But building mock objects for the J2EE interfaces didn't seem realistic. --AndersBengtsson
Do it a bit at a time... A combination of MockObjects, plus an adaption of BusinessInterface, lets me test the business logic of my code with reasonable confidence, letting me push back the full-scale testing for integration time. -- rw