I previously wrote (regarding starting a mail server for JUnit tests):

> I've got a few postings trying to figure out how to do this from Ant,
> with a
> custom task to test to see if it is running. I'm also exploring how to
> kick
> this server off, from inside my JUnit tests.

So, I was down to three candidates:

A) Try the Ant <parallel> clause to start the server and run the JUnit
tests.

B) Modify the custom task to start the server, if it is not running, in
   addition to checking the status of the server.

C) Start the server as part of the JUnit test suite itself.


I haven't tried option (A) yet and am unsure about two things. First, a
delay
is needed, before running the tests, to ensure the server is ready to
accept
messages. Second, since the server doesn't end, and I don't have a way
to
stop it, I'm not sure if the Ant build will ever end. In addition, I
still
need a custom task to detect if the server is running and to set a
property,
so I think this option is more complex than the other options. (I'm
still
curious about how to use the <parallel> option, so I may check into it 
some time).

I was able to get option (B) to work, by having the custom task check to
see if the server is running, run the server if needed, and then
re-check
the server. This was pretty simple and is the way things are running
right
now (Thanks for all the help everyone).

Several people have suggested using the TestSetup class in JUnit to
perform
option (C). I haven't tried this, but may toy with it later on. My main
concern was whether or not JUnit's TestRunner would use the TestSetup
class
or would just bypass this and run the test methods directly (thereby
skipping
the setup call to start the mail server). But, if I understand the
latest
postings, it looks like it will work OK. If I get time to try this, I'll
post an update.


PCM (Paul Michali)

Carrier Voice Gateway Business Unit (CVGBU)
Cisco Systems, Inc.
250 Apollo Drive
Chelmsford, MA 01824

Phone : (800) 572-6771 x 45817  (978) 244-5817 [direct]
Paging: (800) 365-4578 [voice]  [EMAIL PROTECTED] [email page]

Reply via email to