Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

urgent help on passing parameters thru ant script

 
Tom Eric
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to run java code thru junit using ant script.
I need to send the authentication information and some other parameters to junit (jvm..)
How do i pass a parameter to jvm from ant script..
I read ant manual and i am trying to use <jvmarg> tag to pass parameters
but it is not working ..
Can any one help me how to pass parameters to JVM thru ant script ...
My NumberTest.java file has to access data from database.
To access data base I need to send some parameters to Junit JVM like
username, password, authentication information file etc ...

Tahnks.
Here is my code ..
<?xml version="1.0" encoding="ISO-8859-1" ?>
<project name="test" default="all" basedir=".">
<target name="compile" >
<javac srcdir="." debug="on" />
</target>
<target name="all" depends="compile" >
<junit fork="yes" printsummary="yes" haltonfailure="yes">
<jvmarg value="-DJavaCommitTrue"/>
<jvmarg value="-Djava.security.auth.login.config=c:\jboss-3.2.1\client\auth.conf"/>
<classpath>
<pathelement location="c:\ant\lib" />
</classpath>

<formatter type="plain"/>
<test name="test.NumberTests" haltonfailure="no" outfile="result">
</test>
</junit>
</target>

</project>
 
Goncha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe using <arg value="..."> in <junit> will work.
 
Tom Eric
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for your reply .
I need to use <jvmarg value="..." /> only. Previouly I am passing entire thing in value where as if i pass each value using <jvmarg> tag it is working fine ..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic