You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Aaron Colwell <ac...@real.com> on 2005/11/07 21:05:25 UTC

Unit test stub object question

Hi,

I'm using Maven 1.1-beta2 for a project I'm working on. I've split the code
into several projects that I use maven multiproject to build. I'm trying to
figure out the best place to put stub objects for my unit tests. Most of our
stubs go in the src/test/... directory that the unit test is in. I've just
run into the case where one of my subprojects needs a stub from another
project. Basically one project is using an interface from another project and
I want to reuse the stub for that interface. One solution I came up with is
to just put the stubs in the src/main tree so they get added to the project's
jar. The "problem" with this is that I don't really want these objects to
show up in the JavaDoc since they are only intended for unit testing and aren't
intended to be part of the project's API/class hierarchy. The other "problem"
is that by moving them into src/main they no longer live with all the other
unit test code. I like the seperation that Maven creates between test code and
application code. I'd like to maintain that.

Does anyone have any suggestions on how I can keep the stubs in the src/test
tree, but also make them available to unit tests in other sub-projects?

Thanks,

Aaron

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


Re: Unit test stub object question

Posted by Aaron Colwell <ac...@real.com>.
On Mon, Nov 07, 2005 at 09:25:33PM +0100, Arnaud Bailly wrote:
> Aaron Colwell wrote:
> >Hi,
> 
> Hello,
> Could'n you make a separate 'test-stub' project and add a dependency in 
> your project ? This would cleanly separate test code from main code 
> while giving you greater control on how your stub code is structured.

I thought about that. My concern is that I'd have 'test-stub' projects
popping up for each project that needed to share it's stubs. Creating a
project that is the 'union' of all the stubs across sub-projects is also
less desirable because it forces that stub project to have a dependency on
all sub-projects. In my case people will likely only be working with subsets
of the sub-projects. I'm also concerned that the 'test-stub' project creates
a circular dependency. The 'test-stub' project relies on the sub-project for
interface declarations. The sub-project relies on the 'test-stub' project for
its unit test stubs. Does maven deal with that kind of dependency properly?

More suggestions are welcome.

Unfortunately my project isn't quite ready to make the Maven 2.0 jump yet.

Aaron

> 
> Yours,
> 
> PS: I have heard that maven 2.0 gives you a notion of context for 
> dependencies and artifacts that seems to solve this kind of issue.
> 
> 
> -- 
> Arnaud Bailly - Ing?nieur de Recherche
> NORSYS
> 1, rue de la Cense des Raines
> ZAC du Moulin
> 59710 ENNEVELIN
> Tel : (33) 3 28 76 56 76
> Fax : (33) 3 28 76 57 00
> Web : http://www.norsys.fr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Unit test stub object question

Posted by Arnaud Bailly <ab...@norsys.fr>.
Aaron Colwell wrote:
> Hi,

Hello,
Could'n you make a separate 'test-stub' project and add a dependency in 
your project ? This would cleanly separate test code from main code 
while giving you greater control on how your stub code is structured.

Yours,

PS: I have heard that maven 2.0 gives you a notion of context for 
dependencies and artifacts that seems to solve this kind of issue.


-- 
Arnaud Bailly - Ingénieur de Recherche
NORSYS
1, rue de la Cense des Raines
ZAC du Moulin
59710 ENNEVELIN
Tel : (33) 3 28 76 56 76
Fax : (33) 3 28 76 57 00
Web : http://www.norsys.fr

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