The 'main' can still be there, it just won't be run by Ant's <junit> task.

I personally would only use Ant as a JUnit test runner and do not create
'main', but if you want to retain the ability to run them from the
command-line then you can keep it there.

But you can run them from the command-line even without a 'main', you just
run a TestRunner first passing the test case to it.

    Erik


----- Original Message -----
From: "Marcus" <[EMAIL PROTECTED]>
To: "Ant Users List" <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 1:26 PM
Subject: Re: junit jvmarg


> Erik,
>
> So does this mean that in the unit test there should not be 'main'?
>
> -mez
> ----- Original Message -----
> From: "Erik Hatcher" <[EMAIL PROTECTED]>
> To: "Ant Users List" <[EMAIL PROTECTED]>
> Sent: Sunday, January 13, 2002 11:24 AM
> Subject: Re: junit jvmarg
>
>
> > To pass parameters, use <sysparameter>, not <jvmarg>.
> >
> > And then in your test case use System.getParameter("param_name")
> >
> > You will have to refactor your code a bit to adjust it from being a
> > command-line run test case to being one from <junit>, which does not go
> > through 'main'.  But you could adjust your command-line section to use
> > system properties too, and then use java -Dname=val to set parameters -
> then
> > both ways would have the same parameter accepting mechanism.
> >
> >     Erik
> >
> >
> > ----- Original Message -----
> > From: "Marcus" <[EMAIL PROTECTED]>
> > To: "Ant Users List" <[EMAIL PROTECTED]>
> > Sent: Sunday, January 13, 2002 2:16 PM
> > Subject: junit jvmarg
> >
> >
> >
> > I am trying to pass some parameters for my unit test and junit reports
and
> > error.
> > Here is the code I am using:
> > <junit printsummary="yes" fork="yes" haltonfailure="yes">
> >      <jvmarg value="${my.test.TestCase}"/>     <jvmarg value="some
> > parameter"/>     <jvmarg value="some parameter"/>     <jvmarg value="som
e
> > parameter"/>     <jvmarg value="some parameter"/>     <jvmarg
value="some
> > parameter"/>     <jvmarg value="some parameter"/>
> >   <formatter type="plain" />
> >   <test name="my.test.TestCase" />
> > </junit>
> >
> > Where my.test.TestCase needs 6 parameters to run with java
> my.test.TestCase
> > param1 param1
> > param3 param4 param5 param6
> > The above is not right and I was wondering if someone had run junit
> > with a test case that needs parameters passed for the unit test to run?
> > -mez
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> >
> >
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to