ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <epr...@ptc.com>
Subject Re: another unit-test question
Date Wed, 05 Mar 2003 00:42:23 GMT
Erik Hatcher wrote:

> junit.jar=${ant.home}/lib/junit.jar
> 
> in a lib.properties file that gets loaded by the main build file.
> ${ant.home} is automatically set by Ant.

Great.  ${ant.home} was exactly what I needed.  (Actually, it didn't 
work at first, and I wondered if I had done something wrong but my build 
file seemed to be right.  It turns out that junit.jar doesn't work if 
it's a symlink [at least on Cygwin], but when I copied the JAR into 
ANT_HOME it worked great.  Strangely, xalan.jar [for generating reports 
per the <junitreport> task] works fine as a symlink into ANT_HOME.)

> To help answer both your e-mails, please download the JavaDevWithAnt
 > project I've created based on the project Steve and I created for the 
book.

I will definitely check it out.  It is great to have feedback from the 
very people who wrote the book.


later, Erik Hatcher wrote:
> Just to add my $0.02 on this... I don't compile the production and test 
> code together into a single tree.  I keep them separate even for the 
> .class files.  Because of Ant's nice <path> handling, its easy to put 
> them together when you need them together (in <junit> for example).

I hadn't thought of that.  It seems that a lot of the constraints that I 
took for granted (specifically keeping files together, etc) are lifted 
when you explicitly declare classpaths via ant etc.  My interpretation 
of what you are saying is that when you run your unit tests, it is as if 
you were doing a standard "compile" target (your production code goes 
where it's supposed to), and the unit-test .class files go into the 
"test" directory -- and that they never need to be brought into the same 
directory because ant can "see" the unit-test code and the production 
code even when they are in different dirs.

Thanks, I'll adjust my build file to reflect this strategy as it does 
make good sense.


Erik


Mime
View raw message