ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Lyon" <>
Subject RE: passing arguments to JUnit task?
Date Thu, 25 Jul 2002 13:30:01 GMT
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 example:
    <!-- Run the JUnit tests. -->
    <junit fork="yes"
      <jvmarg value="-Ddb.node1=jdbc:oracle:thin:junit_node1/junit@cont01:1521:cdb"/>
      <jvmarg value="-Ddb.node2=jdbc:oracle:thin:junit_node2/junit@cont01:1521:cdb"/>
        <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: <> 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message