• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

How to run JUNIT Tester with 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 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
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Story like this gets better after being told a few times. Or maybe it's just a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic