ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: passing arguments to JUnit task?
Date Thu, 25 Jul 2002 13:58:16 GMT
Lots of people don't seem to know about <sysproperty key="name"
value="value"/>, which is equivalent to <jvmarg value="-Dname=value"/> in
the <java>/<junit> tasks. Just wanted to point it out. --DD

-----Original Message-----
From: Matt Lyon [] 
Sent: Thursday, July 25, 2002 8:30 AM
To: Ant Users List
Subject: RE: passing arguments to JUnit task?

We have some junit test cases that exercize the topology code which manages
the data warehousing aspect of our application. We've had pretty good
success passing database URL arguments as <jvmarg>'s as per the following
    <!-- Run the JUnit tests. -->
    <junit fork="yes"
        <pathelement path="${java.class.path}"/>
        <pathelement path="${cp}"/>
        <pathelement location="${build.output.classes.dir}"/>
      <formatter type="xml"/>
      <test name="com.stargus.platform.topology.AllJUnitTopologyTests"
Not sure if that will help with what you are trying to achieve, but it might
give you some ideas of things to try.

-----Original Message-----
From: David Altenburg []
Sent: Wednesday, July 24, 2002 5:58 PM
To: 'Ant Users List'
Subject: RE: passing arguments to JUnit task?

You may find the <sysproperty> element to be useful.  It's probably not as
simple as what you're looking for (you'd need to modify your test classes to
get the info from that property), but you don't want to depend on your
classes' main methods in order to run the test anyway.


David Altenburg 

>-----Original Message----- 
>From: Dave Jones [] 
>Sent: Wednesday, July 24, 2002 4:20 PM 
>To: Ant Users List 
>Subject: passing arguments to JUnit task? 
>Is there a way to pass arguments to tests running in a JRun task? 
>Background: I have a series of functional and acceptance tests 
>(usually using HTTPUnit) I run against development and staging 
>code. By passing in the server address as a command-line pararm, 
>I can run the same tests against both development and staging. 
>I'd like to include the tests in a build file used to move code 
>into staging. However, I've been unable to figure out how to pass 
>an argument to the included tests to indicate which server to 
>run against. 
>Sample JRun task looks like: 
>       <junit printsummary="true"> 
>       <formatter type="xml" usefile="true" /> 
>          <test name="com.bbyo.test.testProspectAdd" /> 
>Unfortunately, the <test> element does not allow <arg> sub-elements. 
>I could use a Java task to invoke my tests, but then I lose the 
>ability to use <junitreport> (is this correct?) 
>I could also write a wrapper around the tests that passes in the 
>arguments and call the wrappers from the build, but then I've 
>just doubled my number of test files. 
>So, is there a way to pass arguments to tests included in a JRun task? 
>Dave Jones 
>To unsubscribe, e-mail:   
>< mailto:ant-user->> 
>additional commands, 
>e-mail: <> 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message