Ok Here are some pointers to get started :
- In order to be able to automatically start the tests using Ant, you need a
custom ant task. Ant is not able to start a task in parallel for the moment
and then join it with the parent thread on some conditions. This is why I
have developped an Ant task (it's only a few lines) that does this. I am
going to propose it to the Ant mailing list and try to include it in their
optional tasks. Otherwise, it will be bundled with J2EEUnit 0.7. You can
check it at
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/j2eeunit/src/ant/org/apache/to
ols/ant/taskdefs/optional/j2eeunit/J2EEUnitStartServerTask.java?rev=1.1&cont
ent-type=text/x-cvsweb-markup&cvsroot=j2eeunit (that's on the CVS web-based
interface from Sourceforge : http://sourceforge.net/projects/j2eeunit)
- Integrate tasks in the build.xml to start the servlet engine, run the
tests and stop the tests (As some server do not provide a way to shutdown
their server, I'll include a watchdog deamon like feature in my custom Ant
task to kill the server). I have this in the J2EEUnit build.xml script :
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/j2eeunit/src/ant/org/apache/to
ols/ant/taskdefs/optional/j2eeunit/J2EEUnitStartServerTask.java?rev=1.1&cont
ent-type=text/x-cvsweb-markup&cvsroot=j2eeunit
- Do you have any directory structure yet where you'll put the tests ?
- Naming rules for the tests ? (like TestXXX, where XXX is the name of the
class under test)
- Do you put the suite of tests in a separate directory from the main
sources ? But under the same package names (so that we can test protected
methods) ?
- Do you plan to have 2 build.xml, one for the main struts build and another
for the tests or just one (I tend to prefer one and run the tests all the
time) ?
- Do you have a tool (it can be a set of shell scripts and some Ant script)
to do continous builds and run the tests at the same time ? Which sends an
email when there is a build failure ? Actually I am going to write such a
script for J2EEUnit and I can contribute it if you like it. Do you have a
machine where to run this script in a crontab mode ? The answer to all these
are probably yes as you are already doing nighlty builds. The thing left to
do is then to integrate running the tests as part of the nighlty builds,
don't you think so ?
- I guess a page on the Struts web site named something like "Struts Unit
Testing Strategy" and containing the above mentionned issues and answers
could be a good idea ?
What do you think ?
Thanks.
Vincent Massol.