This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to run JUNIT Tester with Ant  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am newbie to Ant. I have read the previous posts about JUNIT/ANT. But I am not quite sure how to resolve my issues...

I can run the JUNIT Tester using the below batch file...

---------------Tester.bat------------
set CLASSPATH="C:\a.jar";"C:\b.jar";"C:\junit-4.1.jar"
C:\jdk1.5.0_06\bin\java -classpath %CLASSPATH% org.junit.runner.JUnitCore com.thoughtworks.selenium.QATester
---------------------------------

If I run the above, batch file, QATester class executes since QATester.class is part of b.jar file.

Now, I have 2 issues...

1) How can I convert the above batch file into Ant target
2) QATester.class file launches http://hostname:8080/xyz . I have hard coded hostname in the class file. Now, my question, how can I pass this hostname as an argument from the Ant target?

Please response. I have been struggling a lot to resolve...

Thanks in advance
 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Micky Morgan:
Please response. I have been struggling a lot to resolve...



What have you tried so far?
 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to run the Class file as below:

<target name="init">
<tstamp/>
<property name="Base" value="C:\"/>
<path id="ccp" description="The CLASSPATH for compiling and running">
<pathelement location="${Base}\a.jar" />
<pathelement location="${Base}\b.jar" />
<pathelement location="${Base}\JUnit.4.1.jar" />
<pathelement location="." />
</path>
</target>

<target name="run" depends="init">
<java classname="com.thoughtworks.selenium.QATester"
fork="true"/>
<classpath refid="ccp" />
</target>
 
Micky Morgan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am answering my own question. I got it from Ant Manual.

<target name="run" depends="on_prev_task">
<java classname="org.junit.runner.JUnitCore">
<arg value="com.thoughtworks.selenium.QATester"/>
<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>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!