ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Michali <>
Subject Re: How to run a background app? (Partial solution)
Date Fri, 21 Sep 2001 14:50:39 GMT
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

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
is needed, before running the tests, to ensure the server is ready to
messages. Second, since the server doesn't end, and I don't have a way
stop it, I'm not sure if the Ant build will ever end. In addition, I
need a custom task to detect if the server is running and to set a
so I think this option is more complex than the other options. (I'm
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
the server. This was pretty simple and is the way things are running
now (Thanks for all the help everyone).

Several people have suggested using the TestSetup class in JUnit to
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
or would just bypass this and run the test methods directly (thereby
the setup call to start the mail server). But, if I understand the
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 page]

View raw message