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="some
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]>

Reply via email to