You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Helck, Christopher" <ch...@ebs.com> on 2004/11/10 22:21:30 UTC

Where should I put reusable test code?

Where should I put test related code that can be used by mutliple
projects?

I have a project DataDictionary that has unit tests and a test helper
class. The Helper is only used by the unit tests and is used to
configure various classes.

Other projects depend on the DataDictionary and there unit tests also
need to configure the same classes. I would like these projects to use
the Helper class.

If I put the Helper class under DataDictionary/src/test then it is not
included in the DataDictionay.jar file and can not be used by other
projects.
If I put the Helper class under DataDictionary/src/java then I'm
polluting my production code with test stuff.
If I put the Helper class in a new project called DataDictionaryTest
with the same package structure as DataDictionary then I fear I'll have
a complex mess on my hands.

Any suggestions?

-C. Helck



The information contained in this e-mail is confidential. This e-mail is intended only for the stated addressee.  If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this e-mail. if you have received this e-mail in error, please inform us immediately and delete it and all copies from your system.

EBS Dealing Resources International Limited. Registered address: 10 Paternoster Square, London EC4M 7DY, United Kingdom. Registered number 2669861.

EBS Dealing Resources, Inc, registered in Delaware. Address: 535 Madison Avenue, 24th Floor, New York, NY 10022, USA, and One upper Pond road, Building F - Floor 3, Parsippany, NJ 07054, USA.

EBS Dealing Resources Japan Limited, a Japanese Corporation. Address: Asteer Kayabacho Bldg, 6th Floor, 1-6-1, Shinkawa, Chuo-Ku,  Tokyo 104-0033, Japan.


Re: Where should I put reusable test code?

Posted by Bent André Solheim <be...@gmail.com>.
Hi Christopher,

I have done the same thing Corey did; put the reusable test code into
an own project. It has paid off so far. Depending on "how reusable"
your Helper class is, you could either create a general purpose
"commons-test" project, or a DataDictionaryTest project. Although it
might seem complex, I believe it's the cleanest solution to your
problem.

Hope this helps.

Regards,
Bent.


On Thu, 11 Nov 2004 16:34:33 +0800, Corey Scott <co...@gmail.com> wrote:
> Christopher,
> 
> For me, I believe this is a personal preference thing, and it seems
> that you have given it some good thought already.  With that said I
> thought I would tell you what I do.  If its a small project/module and
> only 1 or 2 classes and I am feeling lazy, then I just put it in the
> production code in a Util directory (or similar) cause I find that it
> does bloat the jar.
> 
> However if its a big module or there are more than a few util classes
> then I am more inclined to make it into a spearate project altogether,
> cause I find that if I can generalize the util classes enough, they
> often become usable to completely separate (other) projects.
> Eventually with this approach you end up with you effectively end up
> with your own junit extensions/utilities.  I will leave you to
> consider if you like this idea or not?
> 
> Hope this helps,
> Corey
> 
> ---------------------------------------------------------------------
> 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: Where should I put reusable test code?

Posted by Corey Scott <co...@gmail.com>.
Christopher,

For me, I believe this is a personal preference thing, and it seems
that you have given it some good thought already.  With that said I
thought I would tell you what I do.  If its a small project/module and
only 1 or 2 classes and I am feeling lazy, then I just put it in the
production code in a Util directory (or similar) cause I find that it
does bloat the jar.

However if its a big module or there are more than a few util classes
then I am more inclined to make it into a spearate project altogether,
cause I find that if I can generalize the util classes enough, they
often become usable to completely separate (other) projects. 
Eventually with this approach you end up with you effectively end up
with your own junit extensions/utilities.  I will leave you to
consider if you like this idea or not?

Hope this helps,
Corey

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