• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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
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>
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!