Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I pass parameters in Ant

 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would run my JUnit tester like

java -classpath %CLASSPATH% -Dhostname=jetty -Dport=8080 org.junit.runner.JUnitCore com.thoughtworks.selenium.QATester

How would I convert this as ant script? the below script is not working at all. It shows hostnae and port as null???
----------------------
<target name="run" depends="start">
<java classname="org.junit.runner.JUnitCore">
<arg value="com.thoughtworks.selenium.Jasper"/>
<jvmarg value="-Dhostname=jetty"/>
<jvmarg value="-Dport=8080"/>


<classpath>
<pathelement location="C:\Selenium-RC\java\junit-4.1.jar"/>
<pathelement location="C:\Selenium-RC\java\b.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
</target>
 
Joy Mookerji
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Micky
Try the system property
<java>
<sysproperty key="hostname" value="jetty" />
<sysproperty key="port" value="8080" />

</java>
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the ant manual on java task and Junit Task jvmarg may be used if fork is enabled.




[ September 22, 2006: Message edited by: Carol Enderlin ]
[ September 22, 2006: Message edited by: Carol Enderlin ]
 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joy and Carol. Both of your suggestions works for me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic