I've had this challenge as well.  It seems wrong to have unit tests away
from the unit.  However, really you could think of those tests are
"functional" or "Technology Compatiblity Kit" type of tests.  

The DAO tests are focused (I'm guessing) mainly on verifing that the
DAO's for multiple implementations work the same with all providers.
And then, for whatever provider specific code you have, those are in
unit tests bundled in the provider project.  So, if you have a
prototype-tck project, then it doesn't look so bad!  

Check out Fulcrum Security where I have multiple providers and I verify
they work regardless of provider:
http://jakarta.apache.org/turbine/fulcrum/fulcrum-security-api/xref/org/
apache/fulcrum/security/model/test/package-summary.html

I just tossed the tests into the security-api project which in
retrospect was icky, and I would have liked to have kept it totally
separate.  Individual projects just extend the abstract test classes to
provide the startup and shutdown.  Although, I think I like your
approach better, but I wanted an all java solution...

Eric

-----Original Message-----
From: Laurent PETIT [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 14, 2005 10:52 PM
To: Maven Users List
Subject: junit tests factorisation


Hello there,

I'm trying to split a monobloc demo application I'm writing into 
smaller, more usable building blocs.

The current application - assume its name is Prototype - consists of :
- a Service layer
- definitions of DAO interfaces
- 3 different implementations of the DAO interfaces impl.jdbc, 
impl.ibatis, impl.speedo
- a set of unit tests (in src/test) for the service layer
- a set of unit tests (in src/test, really speaking dbUnit tests) for 
the DAO layer
- for the moment, a conf file in src/conf allows the DAO tests to be 
passed on one of the 3 concrete implementations : jdbc, ibatis or
speedo.

What I want to do is have separate maven projects for service, DAO specs

(interfaces), DAO impls :

prototype
prototype-dao
prototype-dao-jdbc
prototype-dao-ibatis
prototype-dao-speedo

At the same time, I don't want to duplicate the unit tests for the DAO 
layer.

I would have been happy if I could have kept the DAO unit tests with the

DAO specs (interfaces) maven project.
But as I don't want the tests to be jarred with the DAO, and as I think 
if I put the tests in the src/test directory, I can't make other project

benefit from it,
the only way I have to mutualize the tests is to create a dao-tests 
maven project :

prototype-dao-tests

What I don't like here is that I have to expose the tests at a high 
level, just to solve some factorisation problem....

Is this the "best practice" to do it, or do I miss the point somewhere ?
Do you know a better way to solve this *common* (I guess) problem with 
project management ?

Thanks in advance for your suggestions,

Regards,

-- 
Laurent Petit

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


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

Reply via email to