• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I pass parameters in Ant

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Micky
Try the system property
<java>
<sysproperty key="hostname" value="jetty" />
<sysproperty key="port" value="8080" />

</java>
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Joy and Carol. Both of your suggestions works for me.
 
reply
    Bookmark Topic Watch Topic
  • New Topic