Brendan,

I do exactly as Dave Ford does - I keep my unit test classes in the same
packages as the production code under test. I find it good for the same
reasons as Dave outlines, and separating them at delivery time using ant
<excludes> in a fileset is very very simple (once you stick to a consistent
naming convention). I took this practise from some junit documentation I
read.

It is pretty easy to exclude/include files from a release or build. I like to keep them separate so my tests don't pollute my main source, and I find that I have utility classes needed for my tests (that may or may not follow the *Test.java convention) and I don't want those in my main source either.


There's probably little point in discussing the merits and demerits of this
practice: it's enough perhaps to say that a lot of developers do things in
both ways and it would be great of maven could facilitate both approaches.

I agree - I prefer to manage 2 separate directories and I think it's easier to understand projects if they're structured that way. But, I do think you're right - it'd be great if Maven could handle either approach.


Couldn't Maven pull test cases given a dir and a patternset? I don't see why technically it has to be in a seperate directory.

Regards,
--Bill



-----Original Message-----
From: Geir Magnusson Jr. [mailto:[EMAIL PROTECTED]
Sent: 12 July 2003 17:59
To: Maven Users List
Subject: Re: Keeping your test source code in a separate, but parallel
source tree



On Saturday, July 12, 2003, at 12:20 PM, Dave Ford wrote:


The Maven web site lists "Keeping your test source code in a separate,
but
parallel source tree" as best practices.

Q1: Why is this a best practice? It just seems like an extra thing to
maintain to me, making package name refactoring for troublesome. I've
been
placing my test class next to the tested class.

smartsoft.util.Date
smartsoft.util.DateTest

By naming them this way, they appear next to each other in dir
listings.


True, although I rarely ever go digging around in the directory to see
what's there.  Generally tools do a good job, such as Eclipse or Idea.

The advantage I see is that you get to have test code that has
package-level access and because it's in a separate tree, it's easy to
build binaries that don't include all the test code...

geir


Q2: If I want to continue my practice of keeping them together, is
there any
way to get Maven to support that?

Thanks


Dave Ford



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to