ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Nordlund <>
Subject Re: Property dir in junit task fails. (Was Re: property dir needed in java and junit tasks)
Date Thu, 21 Sep 2000 14:39:26 GMT
Stefan Bodewig wrote:
> >>>>> "PN" == Peter Nordlund <> writes:
>  PN> Ok, my problem is that I want to run the testsuite, "all my
>  PN> junit-tests" (the tests must be executed in different
>  PN> directories) and get a total summary of it all in ONE SINGLE
>  PN> result file.
> Now _that_ would be useful, but it is plain impossible right now as
> you can only specify the name of a resultfile on a test by test basis
> - and the file would be overwritten for each test.
> I'd like to change that bit, allow users to specify a filename and use
> that for all testresults - probably as an argument to <formatter>. Now
> you'd need a way to append to this file in another run and you are
> done, right?

Yes, I think so.

> <target>
>   <delete file="testresults.txt" />
>   <junit dir="dir1">
>     <formatter type="plain" outfile="testresults" />
>   </junit>
>   <junit dir="dir2">
>     <formatter type="plain" outfile="testresults" append="true" />
>   </junit>
> </target>
> What do you think?
> Stefan

My reflection on your proposal is: now the result-file is
sort of getting outside the junit-task. I don't know if that is
a problem or not.
Also I get a feeling that you need to duplicate some code, or
is there a way to reuse junit-tasks already defined?

I guess the question you have to ask yourself is:
Should this kind of functionality be kept inside one single
junit-task or not.

Maybe my original proposal wasn't the best...
For "run all tests" you probably also have different
classpaths also, not only different execution directories. 
This would mean that the
test and batchtest nested elements also should take a classpath.
test and batchtest would probably grow in complexity then....

Maybe something like this would work?
(but I have a feeling that calling ant recursively and changing
is not working as I expect it to do... I have not investigated it
carefully, but I think I got surprising result when I tried it some time

<target name="alltests">
   <delete file="testresults.txt" />
   <ant target="junit1, junit2">
     <!-- Overide the original formatter -->
     <formatter type="plain" outfile="testresults" append="true" />


* What I guess would be the best solution comes here:
Is there a way to reuse tasks with "ids" and "refids" in some way?
Something like:

 <target name="alltests">
   <delete file="testresults.txt" />
   <!-- Overide the original formatter -->
   <formatter type="plain" outfile="testresults" append="true" />
   <junit refid="junit1id" />
   <junit refid="junit2id" />

Now I am going abroad for a few days so I can't reply to
this discussion for a while, see you later!


View raw message