First and foremost, thank you for your response. I must apologize for the misleading info in my original post. Please find my clarifications inline...
Originally posted by Lasse Koskela:
Note that you're not actually doing unit testing but *integration* testing since you're running your code inside the application server. This kind of tests will inevitably be slower to execute than unit tests.
You're absolutely true. I should have said integration test rather than unit. As I was using Cactus with
Struts (CactusStrutsTest), I was running the test from my
servlet container.
"Agile programming", as you call it, does not mean that you should run your integration tests every 5 minutes. Most practitioners of Extreme Programming, for example, run their unit tests every couple of minutes but I haven't heard of anyone actually running their integration tests every couple of minutes.
Again, you're spot-on too in this aspect.
However, what I really meant to say was that when there is a failure, it could take me several times of modifying the codes and re-running the test before I could remove the failure. If I had multiple failures, that would compound the length of time needed. Certainly, needing to restart the app server for each re-run isn't helping.
Now, imagine if I took on a project that has no test-case classes at all and with codes which passing is actually the exception rather than the rule.....
On why using IT instead of UT, please read on...
I'd suggest you to separate your integration tests and unit tests so that you can run the unit tests within your IDE (should take less than a minute, preferably less than 10 seconds to run all your unit tests), and you can run the slow integration tests on JBoss from the command prompt, for example, with a script that restarts JBoss, deploys the application, and runs the tests.
When
EJB testing is concerned, I've always been using Cactus. I must admit that it is actually a form of integration testing. You're bringing in a very good point, a point which I originally aiming for to achieve, i.e. unit-testing EJB. However, as time was pressing, I resorted to Cactus to test my EJBs as that was the only option I could find within "browser" reach.
Would you be able to fill me in on alternatives for unit-testing EJBs ?However, let's not sway too far away from my main concern which is to find a solution so that I need not restart my JBoss for each testing no matter if it is unit, integration, functional or any other form.
[ April 17, 2005: Message edited by: Ken Loh ]