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 [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 25, 2002 8:30 AM To: Ant Users List Subject: RE: passing arguments to JUnit task? Hi, 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" dir="${build.output.classes.dir}" printsummary="yes" haltonfailure="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"/> <classpath> <pathelement path="${java.class.path}"/> <pathelement path="${cp}"/> <pathelement location="${build.output.classes.dir}"/> </classpath> <formatter type="xml"/> <test name="com.stargus.platform.topology.AllJUnitTopologyTests" todir="${metrics}/junit_reports"/> </junit> </target> Not sure if that will help with what you are trying to achieve, but it might give you some ideas of things to try. Cheers, Matt -----Original Message----- From: David Altenburg [mailto:[EMAIL PROTECTED]] 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. HTH, David Altenburg >-----Original Message----- >From: Dave Jones [ mailto:[EMAIL PROTECTED]] >Sent: Wednesday, July 24, 2002 4:20 PM >To: Ant Users List >Subject: passing arguments to JUnit task? > > >Hi, >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? > >TIA, >Dave Jones >NetEffect > > >-- >To unsubscribe, e-mail: >< mailto:ant-user->[EMAIL PROTECTED]> >For >additional commands, >e-mail: < mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
