ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Shadel <>
Subject Re: How to set a property from a custom task? (LONG)
Date Thu, 20 Sep 2001 19:31:50 GMT
For JUnit setup for several test cases check out


>>> Paul Michali <> 09/20/01 01:07PM >>>

"Frank E. Weiss" wrote:
> I'm wondering if you've ruled out using dependency instead of a property.
> Something like:
> <JUnit name="testmail" depends="mailserverup">
>    ...
> </JUnit>
> <script name="mailserverup">
>     // start mail server, check if up
>     // fail task otherwise (can this be done in ant, or does it need a custom
> task?)
> </script>

I'm not sure that will work. I need to check to see if the server is
running and
if it is, I don't want to try to start (another instance).

What I have right now is starting to look kludgey and complex...

<target name="check.mail.server">
    <dixiecheck />

<target name="start.mail.server" depends="check.mail.server"
    <java classname="dixie" fork="yes" failonerror="yes">
            <pathelement path="..\..\dixie1.7\dixie.jar" />

<target name="recheck.mail.server" depends="start.mail.server"
    <dixiecheck />

<target name="checkpoint" depends="recheck.mail.server"
    <fail message="Unable to start Dixie Mail server for unit testing"/>

<target name="test" depends="compile.tests,checkpoint"
if="junit.present" ...

I'm also having trouble figuring out how to run the start.mail.server
target and
then continuing with the next step. If anyone has any more ideas I can
try them, but
otherwise I may take the suggestion of Thomas Tuft Muller's reply and
add this
server startup to a JUnit test case.

BTW: If I do try to add this to the test case, how do I invoke this
(starting the server) only once for a set of test cases (putting it in
would be a bit of overkill as it runs many times for the various
tests)?  I
thought I remember hearing there was some high level method that is
called only
once for the whole JUnit run. Note: I'm letting JUnit find the test
cases using
reflection, so I have no control over order of test invocation (I

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