You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Daniel John Debrunner <dj...@apache.org> on 2007/04/03 22:54:57 UTC

Junit ant target - why use antcall?

The way junit test runs via ant are setup is a single target 
junit-oneclass and multiple antcall calls to that target, each supplying 
a different test class.

I wondering if there's a good reason to do it this way? The ant junit 
task can take multiple <test> arguments which would achieve exactly the 
same effect.

E.g. (extract)

<junit printsummary="on"
      fork="yes" forkmode="perTest"
      jvm="${derby.junit.jvm}"
      showoutput="yes"
      dir="junit_${derby.junit.timestamp}/testout"
       errorproperty="tests.failed"
       failureproperty="tests.failed">
       <formatter type="xml"/> 	 	
   	
<test name="org.apache.derbyTesting.functionTests.tests.tools._Suite"
   	 	todir="junit_${derby.junit.timestamp}"/>
<test 
name="org.apache.derbyTesting.functionTests.tests.jdbcapi.JDBCDriversEmbeddedTest"
     	 todir="junit_${derby.junit.timestamp}"/>

etc.

This would be a more natural way of writing the ant file and would allow 
the "tests.failed" property to work. I added that the other day but it 
doesn't work because a property set in an antcall is not visible to the 
callee.

Dan.


Re: Junit ant target - why use antcall?

Posted by Andrew McIntyre <mc...@gmail.com>.
On 4/3/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> The way junit test runs via ant are setup is a single target
> junit-oneclass and multiple antcall calls to that target, each supplying
> a different test class.
>
> I wondering if there's a good reason to do it this way?

No, there was no particular reason for doing it that way. Seemed like
a good idea at the time to avoid duplication of settings for the
<junit> task when I added the JDBC 4 tests, I guess, but it looks like
with the perTest fork option, it would be better to just use nested
<test>s. Then we only ever need two <junit>s: one for JDBC 4 / JDK 1.6
and one with the rest of the tests.

andrew