You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brett Porter <bp...@f2network.com.au> on 2003/12/09 05:05:40 UTC

RE: Is it possible to keep unit tests in the same directories as production classes?

It works just fine. Set sourceDirecotry = unitTestSourceDirectory, and
appropriate excludes to the tests and jar plugins so they don't get used
inappropriately.

Then you can tell your team not only can you do that, but by default Maven
makes you follow best practices and in setting it up it has highlighted some
flaws in the environment :)

- Brett

> -----Original Message-----
> From: Chad Woolley [mailto:lists@thewoolleyweb.com] 
> Sent: Tuesday, 9 December 2003 2:12 PM
> To: users@maven.apache.org
> Subject: Re: Is it possible to keep unit tests in the same 
> directories as production classes?
> 
> 
> Hi,
> 
> Is there any particular reason for these vehement and draconian 
> objections? :)
> 
> What are the technical issues caused by this?  I can 
> understand how some 
> plugins won't work, but this could be an acceptable price.  I can 
> understand that separate source trees is the "right" way, but does is 
> have to be the only way?
> 
> In my particular case, I want to setup maven to illustrate 
> it's benefits 
> to the rest of my team.  However, if I tell them I have to totally 
> reorganize the source tree before I can show off maven, I don't think 
> they are going to buy it.
> 
> It seems like it would be to maven's benefit to be as flexible as 
> possible when people are migrating to it.  Otherwise, people may not 
> even want to go to the trouble of trying it...
> 
> Thanks,
> Chad
> 
> Jason van Zyl wrote:
>   > Now I'm going to have add something that halts the build if any
> > derivatives of org.junit.Test* are found in the source directory
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

RE: Is it possible to keep unit tests in the same directories as production classes?

Posted by Jason van Zyl <jv...@maven.org>.
On Mon, 2003-12-08 at 23:05, Brett Porter wrote:
> It works just fine. 

It does not work just fine.

> Set sourceDirecotry = unitTestSourceDirectory, and
> appropriate excludes to the tests and jar plugins so they don't get used
> inappropriately.

Until you have to actually do something useful like run clover.

http://www.apache.org/~jvanzyl/maven-model-clusterfuck.tgz

Chad, here's a live example for you to look at. See how well your tests
run and how well your coverage reports come out. This is just one plugin
that I tried, one that is most important to me. Tests fail all over the
place and the coverage is reported as zero when in fact the coverage is
99.5% But this was just using the suggestion. I'm sure I could find ways
around it but I'm not going to I don't suggest you do either.

Setting those directories the same is an absolutely horrible suggestion
and you're just going shoot yourself in the face if you do because you
immediately buy yourself non-determistic behaviour from all the plugins.

Tell your team members that for the very small input of having to
separate the tests you gain many advantages due to a very simple
separation.

Would it really take you that long to place your tests in another
directory? Are you that unwilling to unchange for what you get.
Separating your sources means you get all Maven's reports without having
to hack plugins in cases where having test/app sources in the same
directory just doesn't work.

I am harsh, but honest $DIETY I am only trying to make your life easier.
 
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org